Пример #1
0
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);

    }

}
Пример #2
0
void XMLEntityDecl::serialize(XSerializeEngine& serEng)
{

    if (serEng.isStoring())
    {
        serEng<<fId;
        serEng<<fValueLen;
        serEng.writeString(fValue);
        serEng.writeString(fName);
        serEng.writeString(fNotationName);
        serEng.writeString(fPublicId);
        serEng.writeString(fSystemId);
        serEng.writeString(fBaseURI);
    }
    else
    {
        serEng>>fId;
        serEng>>fValueLen;
        serEng.readString(fValue);
        serEng.readString(fName);
        serEng.readString(fNotationName);
        serEng.readString(fPublicId);
        serEng.readString(fSystemId);
        serEng.readString(fBaseURI);
    }
}
Пример #3
0
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;

    }

}
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;

    }

}
Пример #5
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;
    }
}
Пример #6
0
void XMLNotationDecl::serialize(XSerializeEngine& serEng)
{
    if (serEng.isStoring())
    {
        serEng<<fId;
        serEng<<fNameSpaceId;
        serEng.writeString(fName);
        serEng.writeString(fPublicId);
        serEng.writeString(fSystemId);
        serEng.writeString(fBaseURI);
    }
    else
    {
        serEng>>fId;
        serEng>>fNameSpaceId;
        serEng.readString(fName);
        serEng.readString(fPublicId);
        serEng.readString(fSystemId);
        serEng.readString(fBaseURI);
    }
}
Пример #7
0
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);

    }

}  
Пример #8
0
void XMLRefInfo::serialize(XSerializeEngine& serEng)
{
    if (serEng.isStoring())
    {   
        serEng<<fDeclared;
        serEng<<fUsed;
        serEng.writeString(fRefName);
    }
    else
    {
        serEng>>fDeclared;
        serEng>>fUsed;
        serEng.readString(fRefName);
    }

}
Пример #9
0
void DTDAttDef::serialize(XSerializeEngine& serEng)
{

    XMLAttDef::serialize(serEng);

    if (serEng.isStoring())
    {
        serEng<<fElemId;
        serEng.writeString(fName);
    }
    else
    {
        serEng>>fElemId;
        serEng.readString(fName);
    }
}
Пример #10
0
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);
    }

}
Пример #11
0
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);
        }
    }
}
Пример #12
0
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;

    }

}
Пример #13
0
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;
    }
}
Пример #14
0
/***
 *
 *  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<<DV_BUILTIN;
            serEng.writeString(dv->getTypeLocalName());
        }
        else
        {
            serEng<<DV_NORMAL;
            serEng<<(int) dv->getType();
            serEng<<dv;
        }
    }
    else
    {
        serEng<<DV_ZERO;
    }

}
Пример #15
0
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);
    }
}
Пример #16
0
void SchemaGrammar::serialize(XSerializeEngine& serEng)
{

    /***
     * don't serialize NamespaceScope*    fNamespaceScope;
     *                 ValidationContext* fValidationContext;
     *                                    fElemNonDeclPool
     ***/

    Grammar::serialize(serEng);

    if (serEng.isStoring())
    {
        //serialize DatatypeValidatorFactory first
        fDatatypeRegistry.serialize(serEng);

        /***
         *
         * Serialize RefHash3KeysIdPool<SchemaElementDecl>* fElemDeclPool;
         * Serialize RefHash3KeysIdPool<SchemaElementDecl>* fGroupElemDeclPool;
         *
        ***/
        XTemplateSerializer::storeObject(fElemDeclPool, serEng);
        XTemplateSerializer::storeObject(fGroupElemDeclPool, serEng);

        /***
         * Serialize NameIdPool<XMLNotationDecl>*           fNotationDeclPool;
         ***/
        XTemplateSerializer::storeObject(fNotationDeclPool, serEng);        
    
        /***
         *
         * Serialize RefHashTableOf<XMLAttDef>*             fAttributeDeclRegistry;
         * Serialize RefHashTableOf<ComplexTypeInfo>*       fComplexTypeRegistry;
         * Serialize RefHashTableOf<XercesGroupInfo>*       fGroupInfoRegistry;
         * Serialize RefHashTableOf<XercesAttGroupInfo>*    fAttGroupInfoRegistry;
         * Serialize RefHashTableOf<XMLRefInfo>*            fIDRefList;
         *
         ***/

        XTemplateSerializer::storeObject(fAttributeDeclRegistry, serEng);
        XTemplateSerializer::storeObject(fComplexTypeRegistry, serEng);
        XTemplateSerializer::storeObject(fGroupInfoRegistry, serEng);
        XTemplateSerializer::storeObject(fAttGroupInfoRegistry, serEng);
       
        /***
         * Serialize RefHash2KeysTableOf<ElemVector>*       fValidSubstitutionGroups;
         ***/
        XTemplateSerializer::storeObject(fValidSubstitutionGroups, serEng);

        /***
         * Serialize RefHashTableOf<XSAnnotation>*       fAnnotations;
         ***/
        XTemplateSerializer::storeObject(fAnnotations, serEng);

        serEng.writeString(fTargetNamespace);
        serEng<<fValidated;

        /***
         * serialize() method shall be used to store object
         * which has been created in ctor
         ***/
        fGramDesc->serialize(serEng);

    }
    else
    {
        fDatatypeRegistry.serialize(serEng);

        /***
         *
         * Deserialize RefHash3KeysIdPool<SchemaElementDecl>* fElemDeclPool;
         * Deserialize RefHash3KeysIdPool<SchemaElementDecl>* fGroupElemDeclPool;
         *
        ***/
        XTemplateSerializer::loadObject(&fElemDeclPool, 109, true, 128, serEng);
        XTemplateSerializer::loadObject(&fGroupElemDeclPool, 109, true, 128, serEng);

        /***
         * Deserialize NameIdPool<XMLNotationDecl>*           fNotationDeclPool;
         ***/
        XTemplateSerializer::loadObject(&fNotationDeclPool, 109, 128, serEng);        
    
        /***
         *
         * Deserialize RefHashTableOf<XMLAttDef>*             fAttributeDeclRegistry;
         * Deserialize RefHashTableOf<ComplexTypeInfo>*       fComplexTypeRegistry;
         * Deserialize RefHashTableOf<XercesGroupInfo>*       fGroupInfoRegistry;
         * Deserialize RefHashTableOf<XercesAttGroupInfo>*    fAttGroupInfoRegistry;
         * Deserialize RefHashTableOf<XMLRefInfo>*            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<ElemVector>*       fValidSubstitutionGroups;
         ***/
        XTemplateSerializer::loadObject(&fValidSubstitutionGroups, 29, true, serEng);

        /***
         * Deserialize RefHashTableOf<XSAnnotation>*       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);

    }
}
Пример #17
0
void ComplexTypeInfo::serialize(XSerializeEngine& serEng)
{

    if (serEng.isStoring())
    {
        serEng<<fAnonymous;
        serEng<<fAbstract;
        serEng<<fAdoptContentSpec;
        serEng<<fAttWithTypeId;
        serEng<<fPreprocessed;
        serEng<<fDerivedBy;
        serEng<<fBlockSet;
        serEng<<fFinalSet;
        serEng<<fScopeDefined;
        serEng<<fElementId;
        serEng<<fContentType;

        serEng.writeString(fTypeName);
        serEng.writeString(fTypeLocalName);
        serEng.writeString(fTypeUri);

        DatatypeValidator::storeDV(serEng, fBaseDatatypeValidator);
        DatatypeValidator::storeDV(serEng, fDatatypeValidator);

        serEng<<fBaseComplexTypeInfo;
        serEng<<fContentSpec;
        serEng<<fAttWildCard;
        serEng<<fAttList;

        /***
         *
         * Serialize RefVectorOf<SchemaElementDecl>*    fElements;
         * Serialize RefHash2KeysTableOf<SchemaAttDef>* fAttDefs;
         ***/
        XTemplateSerializer::storeObject(fElements, serEng);
        XTemplateSerializer::storeObject(fAttDefs, serEng);

        /***
         *   Don't serialize
         *
         *   fContentModel;
         *   fFormattedModel;
         *   fLocator;
         *   fSpecNodesToDelete
         *
         *   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>>fElementId;
        serEng>>fContentType;

        serEng.readString(fTypeName);
        serEng.readString(fTypeLocalName);
        serEng.readString(fTypeUri);

        fBaseDatatypeValidator = DatatypeValidator::loadDV(serEng);
        fDatatypeValidator     = DatatypeValidator::loadDV(serEng);

        serEng>>fBaseComplexTypeInfo;
        serEng>>fContentSpec;
        serEng>>fAttWildCard;
        serEng>>fAttList;

        /***
         *
         * Deserialize RefVectorOf<SchemaElementDecl>*    fElements;
         * Deserialize RefHash2KeysTableOf<SchemaAttDef>* fAttDefs;
         ***/
        XTemplateSerializer::loadObject(&fElements, 8, false, serEng);
        XTemplateSerializer::loadObject(&fAttDefs, 29, true, serEng);

        /***
         *   Don't deserialize
         *
         *   fFormattedModel;
         *   fLocator;
         *   fSpecNodesToDelete
         *
         *   fContentSpecOrgURI:     start of the array
         *   fContentSpecOrgURISize: size of the array
         *   fUniqueURI:             the current last element in the array
         ***/

        fFormattedModel = 0;
        fLocator = 0;
        fSpecNodesToDelete = 0;
        fContentSpecOrgURI = 0;
        fContentSpecOrgURISize = 0;
        fUniqueURI = 0;
    }
}
Пример #18
0
void DatatypeValidator::serialize(XSerializeEngine& serEng)
{

    if (serEng.isStoring())
    {
        serEng<<fAnonymous;
        serEng<<fWhiteSpace;
        serEng<<fFinalSet;
        serEng<<fFacetsDefined;
        serEng<<fFixed;
        serEng<<(int)fType;

        serEng<<(int)fOrdered;
        serEng<<fFinite;
        serEng<<fBounded;
        serEng<<fNumeric;

        /***
         * don't serialize the fBaseValidator if it is a built-in
         ***/
        if (isBuiltInDV(fBaseValidator))
        {
            serEng<<true;
            serEng.writeString(fBaseValidator->getTypeName());
        }
        else
        {
            serEng<<false;
            storeDV(serEng, fBaseValidator);
        }

        /***
         *  Serialize RefHashTableOf<KVStringPair>
         ***/
        XTemplateSerializer::storeObject(fFacets, serEng);

        serEng.writeString(fPattern);

        /***
         * don't serialize 
         *       fRegex
         *       fTypeLocalName
         *       fTypeUri
         ***/
        serEng.writeString(fTypeName);

    }
    else
    {
        serEng>>fAnonymous;
        serEng>>fWhiteSpace;
        serEng>>fFinalSet;
        serEng>>fFacetsDefined;
        serEng>>fFixed;

        int type;
        serEng>>type;
        fType=(ValidatorType)type;

        serEng>>type;
        fOrdered = (XSSimpleTypeDefinition::ORDERING)type;
        serEng>>fFinite;
        serEng>>fBounded;
        serEng>>fNumeric;

        /***
         *
         *  get the basevalidator's type
         *
         ***/
        bool isBuiltInDV = false;
        serEng>>isBuiltInDV;

        if (isBuiltInDV)
        {
            XMLCh* baseTypeName;
            serEng.readString(baseTypeName);
            ArrayJanitor<XMLCh> janName(baseTypeName, fMemoryManager);

            /***
             *  Link to the fBuiltInRegistry
             *
             *  Since DatatypeValidatorFactory is always the first one
             *  to be deserialized in SchemaGrammar, we are sure that
             *  the BuiltInRegistry shall be available now.
             ***/
            fBaseValidator = DatatypeValidatorFactory::getBuiltInRegistry()->get(baseTypeName);
        }
        else
        {
            fBaseValidator = loadDV(serEng);
        }

        /***
         *
         *  Deserialize RefHashTableOf<KVStringPair>
         *
         ***/
        XTemplateSerializer::loadObject(&fFacets, 29, true, serEng);

        serEng.readString(fPattern);

        /***
         * don't serialize fRegex
         ***/
        fRegex = 0;

        /***
         *   Recreate through setTypeName()
         *       fTypeName
         *       fTypeLocalName
         *       fTypeUri
         ***/
        XMLCh* typeName;
        serEng.readString(typeName);
        ArrayJanitor<XMLCh> janName(typeName, fMemoryManager);
        setTypeName(typeName);

    }

}
Пример #19
0
void DatatypeValidator::serialize(XSerializeEngine& serEng)
{

    if (serEng.isStoring())
    {
        serEng<<fAnonymous;
        serEng<<fFinite;
        serEng<<fBounded;
        serEng<<fNumeric;

        serEng<<fWhiteSpace;
        serEng<<fFinalSet;
        serEng<<fFacetsDefined;
        serEng<<fFixed;

        serEng<<(int)fType;
        serEng<<(int)fOrdered;

        storeDV(serEng, fBaseValidator);

        /***
         *  Serialize RefHashTableOf<KVStringPair>
         ***/
        XTemplateSerializer::storeObject(fFacets, serEng);

        serEng.writeString(fPattern);

        if (fTypeUri==XMLUni::fgZeroLenString)
        {
            serEng<<TYPENAME_ZERO;
        }
        else if (fTypeUri == SchemaSymbols::fgURI_SCHEMAFORSCHEMA)
        {
            serEng<<TYPENAME_S4S;
            serEng.writeString(fTypeLocalName);
        }
        else
        {        
            serEng<<TYPENAME_NORMAL;
            serEng.writeString(fTypeLocalName);
            serEng.writeString(fTypeUri);
        }

        /***
         * don't serialize 
         *       fRegex
         ***/    
    }
    else
    {
        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<KVStringPair>
         *
         ***/
        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<XMLCh> janName(typeLocalName, fMemoryManager);

            setTypeName(typeLocalName);
        }
        else // TYPENAME_NORMAL
        {
            XMLCh* typeLocalName;
            serEng.readString(typeLocalName);
            ArrayJanitor<XMLCh> janName(typeLocalName, fMemoryManager);

            XMLCh* typeUri;
            serEng.readString(typeUri);
            ArrayJanitor<XMLCh> janUri(typeUri, fMemoryManager);

            setTypeName(typeLocalName, typeUri);
        }

        /***
         * don't serialize fRegex
         ***/
        fRegex = new (fMemoryManager) RegularExpression(fPattern, SchemaSymbols::fgRegEx_XOption, fMemoryManager);

    }

}
Пример #20
0
void ComplexTypeInfo::serialize(XSerializeEngine& serEng)
{

    if (serEng.isStoring())
    {
        serEng<<fAnonymous;
        serEng<<fAbstract;
        serEng<<fAdoptContentSpec;
        serEng<<fAttWithTypeId;
        serEng<<fPreprocessed;
        serEng<<fDerivedBy;
        serEng<<fBlockSet;
        serEng<<fFinalSet;
        serEng<<fScopeDefined;
        serEng<<fContentType;

        serEng<<fElementId;

        serEng.writeString(fTypeName);
        serEng.writeString(fTypeLocalName);
        serEng.writeString(fTypeUri);

        DatatypeValidator::storeDV(serEng, fBaseDatatypeValidator);
        DatatypeValidator::storeDV(serEng, fDatatypeValidator);

        serEng<<fBaseComplexTypeInfo;
        serEng<<fContentSpec;
        serEng<<fAttWildCard;
        serEng<<fAttList;

        /***
         *
         * Serialize RefVectorOf<SchemaElementDecl>*    fElements;
         * Serialize RefHash2KeysTableOf<SchemaAttDef>* 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<SchemaElementDecl>*    fElements;
         * Deserialize RefHash2KeysTableOf<SchemaAttDef>* 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);
    }
}
Пример #21
0
void SchemaElementDecl::serialize(XSerializeEngine& serEng)
{

    XMLElementDecl::serialize(serEng);

    if (serEng.isStoring())
    {
        serEng<<(int)fModelType;

        DatatypeValidator::storeDV(serEng, fDatatypeValidator);

        serEng<<fEnclosingScope;
        serEng<<fFinalSet;
        serEng<<fBlockSet;
        serEng<<fMiscFlags;

        serEng.writeString(fDefaultValue);

        serEng<<fComplexTypeInfo;

        /***
         * Serialize RefHash2KeysTableOf<SchemaAttDef>* fAttDefs;
         ***/

        XTemplateSerializer::storeObject(fAttDefs, serEng);

        serEng<<fXsiComplexTypeInfo;

        DatatypeValidator::storeDV(serEng, (DatatypeValidator*)fXsiSimpleTypeInfo);

        /***
         * Serialize RefVectorOf<IdentityConstraint>*   fIdentityConstraints;
         ***/
        XTemplateSerializer::storeObject(fIdentityConstraints, serEng);

        serEng<<fAttWildCard;
        serEng<<fSubstitutionGroupElem;
        serEng<<(int)fValidity;
        serEng<<(int)fValidation;
        serEng<<fSeenValidation;
        serEng<<fSeenNoValidation;
        serEng<<fHadContent;
            
    }
    else
    {
        int i;
        serEng>>i;
        fModelType = (ModelTypes)i;

        fDatatypeValidator = DatatypeValidator::loadDV(serEng);

        serEng>>fEnclosingScope;
        serEng>>fFinalSet;
        serEng>>fBlockSet;
        serEng>>fMiscFlags;

        serEng.readString(fDefaultValue);

        serEng>>fComplexTypeInfo;

        /***
         * DeSerialize RefHash2KeysTableOf<SchemaAttDef>* fAttDefs;
         ***/
        XTemplateSerializer::loadObject(&fAttDefs, 29, true, serEng);

        serEng>>fXsiComplexTypeInfo;

        fXsiSimpleTypeInfo = DatatypeValidator::loadDV(serEng);

        /***
         * DeSerialize RefVectorOf<IdentityConstraint>*   fIdentityConstraints;
         ***/
        XTemplateSerializer::loadObject(&fIdentityConstraints, 16, true, serEng);

        serEng>>fAttWildCard;
        serEng>>fSubstitutionGroupElem;

        serEng>>i;
        fValidity = (PSVIDefs::Validity)i;

        serEng>> i;
        fValidation = (PSVIDefs::Validation)i;
        serEng>>fSeenValidation;
        serEng>>fSeenNoValidation;
        serEng>>fHadContent;

    }

}