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; serEng<<fRawDataLen; // we purposely write this seperatly serEng.writeString(fRawData); serEng.writeString(fIntVal); } else { serEng>>fSign; serEng>>fTotalDigits; serEng>>fScale; serEng>>fRawDataLen; serEng.readString(fRawData); serEng.readString(fIntVal); } }
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; } else { serEng>>fTotalDigits; serEng>>fFractionDigits; } }
void XMLSchemaDescriptionImpl::serialize(XSerializeEngine& serEng) { XMLSchemaDescription::serialize(serEng); if (serEng.isStoring()) { serEng<<(int)fContextType; serEng.writeString(fNamespace); /*** * * Serialize RefArrayVectorOf<XMLCh>* fLocationHints; * ***/ XTemplateSerializer::storeObject(fLocationHints, serEng); QName* tempQName = (QName*)fTriggeringComponent; serEng<<tempQName; tempQName = (QName*)fEnclosingElementName; serEng<<tempQName; XMLAttDef* tempAttDef = (XMLAttDef*)fAttributes; serEng<<tempAttDef; } else { int i; 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<XMLCh> fLocationHints * ***/ XTemplateSerializer::loadObject(&fLocationHints, 4, true, serEng); QName* tempQName; serEng>>tempQName; fTriggeringComponent = tempQName; serEng>>tempQName; fEnclosingElementName = tempQName; XMLAttDef* tempAttDef; serEng>>tempAttDef; fAttributes=tempAttDef; } }
void DatatypeValidatorFactory::serialize(XSerializeEngine& serEng) { // Need not to serialize static data member, fBuiltInRegistry if (serEng.isStoring()) { /*** * Serialize RefHashTableOf<DatatypeValidator> ***/ XTemplateSerializer::storeObject(fUserDefinedRegistry, serEng); } else { /*** * DV in the UserDefinedRegistry rely on the fBuiltInRegistry * to resolve their built-in baseValidator ***/ expandRegistryToFullSchemaSet(); /*** * Deserialize RefHashTableOf<DatatypeValidator> ***/ XTemplateSerializer::loadObject(&fUserDefinedRegistry, 29, true, serEng); } }
void DTDAttDef::serialize(XSerializeEngine& serEng) { XMLAttDef::serialize(serEng); if (serEng.isStoring()) { serEng<<fElemId; serEng.writeString(fName); } else { serEng>>fElemId; serEng.readString(fName); } }
void XMLRefInfo::serialize(XSerializeEngine& serEng) { if (serEng.isStoring()) { serEng<<fDeclared; serEng<<fUsed; serEng.writeString(fRefName); } else { serEng>>fDeclared; serEng>>fUsed; serEng.readString(fRefName); } }
void KVStringPair::serialize(XSerializeEngine& serEng) { if (serEng.isStoring()) { serEng.writeString(fKey, fKeyAllocSize, XSerializeEngine::toWriteBufferLen); serEng.writeString(fValue, fValueAllocSize, XSerializeEngine::toWriteBufferLen); } else { int dataLen = 0; serEng.readString(fKey, (int&)fKeyAllocSize, dataLen, XSerializeEngine::toReadBufferLen); serEng.readString(fValue, (int&)fValueAllocSize, dataLen, XSerializeEngine::toReadBufferLen); } }
void SchemaAttDefList::serialize(XSerializeEngine& serEng) { XMLAttDefList::serialize(serEng); if (serEng.isStoring()) { /*** * * Serialize RefHash2KeysTableOf<SchemaAttDef> * ***/ XTemplateSerializer::storeObject(fList, serEng); serEng.writeSize (fCount); // do not serialize fEnum } else { /*** * * Deserialize RefHash2KeysTableOf<SchemaAttDef> * ***/ 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<SchemaAttDef>(fList, false, getMemoryManager()); } if(fSize) { (getMemoryManager())->deallocate(fArray); fArray = (SchemaAttDef **)((getMemoryManager())->allocate( sizeof(SchemaAttDef*) * fSize)); fCount = 0; while(fEnum->hasMoreElements()) { fArray[fCount++] = &fEnum->nextElement(); } } } }
/*** * * 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::binToText((unsigned long)inNameLen, value1, 16, 10, manager); XMLString::binToText((unsigned long)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; }
void DTDElementDecl::serialize(XSerializeEngine& serEng) { XMLElementDecl::serialize(serEng); if (serEng.isStoring()) { serEng<<(int) fModelType; /*** * * Serialize RefHashTableOf<DTDAttDef> * ***/ XTemplateSerializer::storeObject(fAttDefs, serEng); serEng<<fAttList; serEng<<fContentSpec; /*** * don't serialize * * XMLContentModel* fContentModel; * XMLCh* fFormattedModel; * ***/ } else { int i; serEng>>i; fModelType=(ModelTypes)i; /*** * * Deserialize RefHashTableOf<DTDAttDef> * ***/ XTemplateSerializer::loadObject(&fAttDefs, 29, true, serEng); serEng>>fAttList; serEng>>fContentSpec; /*** * don't deserialize * * XMLContentModel* fContentModel; * XMLCh* fFormattedModel; * ***/ fContentModel = 0; fFormattedModel = 0; } }
void XSAnnotation::serialize(XSerializeEngine& serEng) { if (serEng.isStoring()) { serEng.writeString(fContents); serEng<<fNext; serEng.writeString(fSystemId); serEng<<fLine; serEng<<fCol; } else { serEng.readString(fContents); serEng>>fNext; serEng.readString(fSystemId); serEng>>fLine; serEng>>fCol; } }
void SchemaAttDef::serialize(XSerializeEngine& serEng) { XMLAttDef::serialize(serEng); if (serEng.isStoring()) { serEng.writeSize (fElemId); serEng<<(int)fPSVIScope; serEng<<fAttName; DatatypeValidator::storeDV(serEng, fDatatypeValidator); /*** * Serialize ValueVectorOf<unsigned int> ***/ XTemplateSerializer::storeObject(fNamespaceList, serEng); serEng<<fBaseAttDecl; } else { serEng.readSize (fElemId); int i; serEng>>i; fPSVIScope = (PSVIDefs::PSVIScope)i; serEng>>fAttName; fDatatypeValidator = DatatypeValidator::loadDV(serEng); /*** * Deserialize ValueVectorOf<unsigned int> ***/ XTemplateSerializer::loadObject(&fNamespaceList, 8, false, serEng); serEng>>fBaseAttDecl; } }
void DTDGrammar::serialize(XSerializeEngine& serEng) { Grammar::serialize(serEng); //don't serialize fDefaultEntities if (serEng.isStoring()) { /*** * * Serialize NameIdPool<DTDElementDecl>* fElemDeclPool; * Serialize NameIdPool<DTDEntityDecl>* fEntityDeclPool; * Serialize NameIdPool<XMLNotationDecl>* fNotationDeclPool; ***/ XTemplateSerializer::storeObject(fElemDeclPool, serEng); XTemplateSerializer::storeObject(fEntityDeclPool, serEng); XTemplateSerializer::storeObject(fNotationDeclPool, serEng); serEng<<fRootElemId; serEng<<fValidated; /*** * serialize() method shall be used to store object * which has been created in ctor ***/ fGramDesc->serialize(serEng); } else { /*** * * Deserialize NameIdPool<DTDElementDecl>* fElemDeclPool; * Deserialize NameIdPool<DTDEntityDecl>* fEntityDeclPool; * Deerialize NameIdPool<XMLNotationDecl>* fNotationDeclPool; ***/ XTemplateSerializer::loadObject(&fElemDeclPool, 109, 128, serEng); fElemNonDeclPool = 0; XTemplateSerializer::loadObject(&fEntityDeclPool, 109, 128, serEng); XTemplateSerializer::loadObject(&fNotationDeclPool, 109, 128, serEng); serEng>>fRootElemId; serEng>>fValidated; /*** * serialize() method shall be used to load object * which has been created in ctor ***/ fGramDesc->serialize(serEng); } }
void SchemaAttDef::serialize(XSerializeEngine& serEng) { XMLAttDef::serialize(serEng); if (serEng.isStoring()) { serEng<<fElemId; serEng<<(int)fValidity; serEng<<(int)fValidation; serEng<<(int)fPSVIScope; serEng<<fAttName; DatatypeValidator::storeDV(serEng, fDatatypeValidator); DatatypeValidator::storeDV(serEng, fAnyDatatypeValidator); DatatypeValidator::storeDV(serEng, (DatatypeValidator*)fMemberTypeValidator); /*** * Serialize ValueVectorOf<unsigned int> ***/ XTemplateSerializer::storeObject(fNamespaceList, serEng); serEng<<fBaseAttDecl; } else { serEng>>fElemId; int i; serEng>>i; fValidity = (PSVIDefs::Validity)i; serEng>>i; fValidation = (PSVIDefs::Validation)i; serEng>>i; fPSVIScope = (PSVIDefs::PSVIScope)i; serEng>>fAttName; fDatatypeValidator = DatatypeValidator::loadDV(serEng); fAnyDatatypeValidator = DatatypeValidator::loadDV(serEng); fMemberTypeValidator = DatatypeValidator::loadDV(serEng); /*** * Deserialize ValueVectorOf<unsigned int> ***/ XTemplateSerializer::loadObject(&fNamespaceList, 8, false, serEng); serEng>>fBaseAttDecl; } }
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<<fCurId; for (unsigned int index = 1; index < fCurId; index++) { const XMLCh* stringData = getValueForId(index); serEng.writeString(stringData); } } else { unsigned int mapSize; 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); } } }
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; } }
void XMLElementDecl::serialize(XSerializeEngine& serEng) { if (serEng.isStoring()) { serEng<<fElementName; serEng<<(int) fCreateReason; serEng.writeSize (fId); serEng<<fExternalElement; } else { serEng>>fElementName; int i; serEng>>i; fCreateReason=(CreateReasons)i; serEng.readSize (fId); serEng>>fExternalElement; } }
void XercesAttGroupInfo::serialize(XSerializeEngine& serEng) { if (serEng.isStoring()) { serEng<<fTypeWithId; serEng<<fNameId; serEng<<fNamespaceId; /*** * * Serialize RefVectorOf<SchemaAttDef>* fAttributes; * ***/ XTemplateSerializer::storeObject(fAttributes, serEng); /*** * * Serialize RefVectorOf<SchemaAttDef>* fAnyAttributes; * ***/ XTemplateSerializer::storeObject(fAnyAttributes, serEng); serEng<<fCompleteWildCard; } else { serEng>>fTypeWithId; serEng>>fNameId; serEng>>fNamespaceId; /*** * * Deserialize RefVectorOf<SchemaAttDef>* fAttributes; * ***/ XTemplateSerializer::loadObject(&fAttributes, 4, true, serEng); /*** * * Deserialize RefVectorOf<SchemaAttDef>* fAnyAttributes; * ***/ XTemplateSerializer::loadObject(&fAnyAttributes, 2, true, serEng); serEng>>fCompleteWildCard; } }
void XSAnnotation::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.writeString(fContents); serEng<<fNext; } else { serEng.readString(fContents); serEng>>fNext; } }
void IC_KeyRef::serialize(XSerializeEngine& serEng) { IdentityConstraint::serialize(serEng); if (serEng.isStoring()) { IdentityConstraint::storeIC(serEng, fKey); } else { fKey = IdentityConstraint::loadIC(serEng); } }
void XercesNodeTest::serialize(XSerializeEngine& serEng) { if (serEng.isStoring()) { serEng<<fType; serEng<<fName; } else { serEng>>fType; serEng>>fName; } }
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)); }
void XercesXPath::serialize(XSerializeEngine& serEng) { if (serEng.isStoring()) { serEng<<fEmptyNamespaceId; serEng.writeString(fExpression); /*** * Serialize RefVectorOf<XercesLocationPath>* fLocationPaths; ***/ XTemplateSerializer::storeObject(fLocationPaths, serEng); } else { serEng>>fEmptyNamespaceId; serEng.readString(fExpression); /*** * Deserialize RefVectorOf<XercesLocationPath>* fLocationPaths; ***/ XTemplateSerializer::loadObject(&fLocationPaths, 8, true, serEng); } }
void IdentityConstraint::serialize(XSerializeEngine& serEng) { if (serEng.isStoring()) { serEng.writeString(fIdentityConstraintName); serEng.writeString(fElemName); serEng<<fSelector; serEng<<fNamespaceURI; /*** * * Serialize RefVectorOf<IC_Field>* fFields; * ***/ XTemplateSerializer::storeObject(fFields, serEng); } else { serEng.readString(fIdentityConstraintName); serEng.readString(fElemName); serEng>>fSelector; serEng>>fNamespaceURI; /*** * * Deserialize RefVectorOf<IC_Field>* fFields; * ***/ XTemplateSerializer::loadObject(&fFields, 4, true, serEng); } }
void DTDGrammar::serialize(XSerializeEngine& serEng) { Grammar::serialize(serEng); //don't serialize fDefaultEntities if (serEng.isStoring()) { /*** * * Serialize NameIdPool<DTDElementDecl>* fElemDeclPool; * Serialize NameIdPool<DTDEntityDecl>* fEntityDeclPool; * Serialize NameIdPool<XMLNotationDecl>* fNotationDeclPool; ***/ XTemplateSerializer::storeObject(fElemDeclPool, serEng); XTemplateSerializer::storeObject(fEntityDeclPool, serEng); XTemplateSerializer::storeObject(fNotationDeclPool, serEng); serEng<<fRootElemId; serEng<<fValidated; serEng<<fGramDesc; } else { /*** * * Deserialize NameIdPool<DTDElementDecl>* fElemDeclPool; * Deserialize NameIdPool<DTDEntityDecl>* fEntityDeclPool; * Deerialize NameIdPool<XMLNotationDecl>* fNotationDeclPool; ***/ XTemplateSerializer::loadObject(&fElemDeclPool, 109, 128, serEng); fElemNonDeclPool = 0; XTemplateSerializer::loadObject(&fEntityDeclPool, 109, 128, serEng); XTemplateSerializer::loadObject(&fNotationDeclPool, 109, 128, serEng); serEng>>fRootElemId; serEng>>fValidated; XMLDTDDescriptionImpl* gramDesc; serEng>>gramDesc; fGramDesc = gramDesc; } }
void IC_Selector::serialize(XSerializeEngine& serEng) { if (serEng.isStoring()) { serEng<<fXPath; IdentityConstraint::storeIC(serEng, fIdentityConstraint); } else { serEng>>fXPath; fIdentityConstraint = IdentityConstraint::loadIC(serEng); } }
void XercesStep::serialize(XSerializeEngine& serEng) { if (serEng.isStoring()) { serEng<<(int)fAxisType; serEng<<fNodeTest; } else { int i; serEng>>i; fAxisType = (unsigned short) i; serEng>>fNodeTest; } }
void DTDEntityDecl::serialize(XSerializeEngine& serEng) { XMLEntityDecl::serialize(serEng); if (serEng.isStoring()) { serEng<<fDeclaredInIntSubset; serEng<<fIsParameter; serEng<<fIsSpecialChar; } else { serEng>>fDeclaredInIntSubset; serEng>>fIsParameter; serEng>>fIsSpecialChar; } }
void XercesLocationPath::serialize(XSerializeEngine& serEng) { if (serEng.isStoring()) { /*** * Serialize RefVectorOf<XercesStep>* fSteps; ***/ XTemplateSerializer::storeObject(fSteps, serEng); } else { /*** * Deserialize RefVectorOf<XercesStep>* fSteps; ***/ XTemplateSerializer::loadObject(&fSteps, 8, true, serEng); } }
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; serEng.writeString(fRawData); serEng.writeString(fIntVal); } else { serEng>>fSign; serEng>>fTotalDigits; serEng>>fScale; XMLCh* rawdataStr; serEng.readString(rawdataStr); ArrayJanitor<XMLCh> rawdataName(rawdataStr, serEng.getMemoryManager()); fRawDataLen = XMLString::stringLen(rawdataStr); XMLCh* intvalStr; serEng.readString(intvalStr); ArrayJanitor<XMLCh> 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; } }