peiyongz 2003/10/14 08:22:29
Modified: c/src/xercesc/validators/schema ComplexTypeInfo.cpp
SchemaElementDecl.cpp SchemaElementDecl.hpp
SchemaGrammar.cpp SchemaGrammar.hpp
XercesAttGroupInfo.cpp XercesAttGroupInfo.hpp
XercesGroupInfo.cpp XercesGroupInfo.hpp
XMLSchemaDescriptionImpl.cpp
XMLSchemaDescriptionImpl.hpp
Log:
Implementation of Serialization/Deserialization
Revision Changes Path
1.13 +93 -14 xml-xerces/c/src/xercesc/validators/schema/ComplexTypeInfo.cpp
Index: ComplexTypeInfo.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/ComplexTypeInfo.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ComplexTypeInfo.cpp 10 Oct 2003 16:25:40 -0000 1.12
+++ ComplexTypeInfo.cpp 14 Oct 2003 15:22:28 -0000 1.13
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.13 2003/10/14 15:22:28 peiyongz
+ * Implementation of Serialization/Deserialization
+ *
* Revision 1.12 2003/10/10 16:25:40 peiyongz
* Implementation of Serialization/Deserialization
*
@@ -928,10 +931,20 @@
serEng<<fAttList;
/***
- * TO DO: once SchemaElementDecl is done
+ *
* Serialize RefVectorOf<SchemaElementDecl>* fElements;
*
***/
+ if (serEng.needToWriteTemplateObject(fElements))
+ {
+ int vectorLength = fElements->size();
+ serEng<<vectorLength;
+
+ for ( int i = 0 ; i < vectorLength; i++)
+ {
+ serEng<<fElements->elementAt(i);
+ }
+ }
/***
*
@@ -984,9 +997,32 @@
*
***/
- serEng<<*fContentSpecOrgURI;
- serEng<<fUniqueURI;
- serEng<<fContentSpecOrgURISize;
+ /***
+ *
+ * fContentSpecOrgURI: start of the array
+ * fContentSpecOrgURISize: size of the array
+ * fUniqueURI: the current last element in the array
+ *
+ * TODO: could we treat this the same way as fContentModel?
+ *
+ ***/
+ if (fContentSpecOrgURI)
+ {
+ serEng<<(int)1;
+ serEng<<fContentSpecOrgURISize;
+ serEng<<fUniqueURI;
+
+ unsigned int* tempURI = fContentSpecOrgURI;
+ for (unsigned int i = 0 ; i < fUniqueURI; i++)
+ {
+ serEng<<*tempURI;
+ tempURI++;
+ }
+ }
+ else
+ {
+ serEng<<(int)0;
+ }
/***
* don't serialize
@@ -1010,8 +1046,8 @@
serEng>>fContentType;
serEng.readString(fTypeName);
- serEng.writeString(fTypeLocalName);
- serEng.writeString(fTypeUri);
+ serEng.readString(fTypeLocalName);
+ serEng.readString(fTypeUri);
fBaseDatatypeValidator = DatatypeValidator::loadDV(serEng);
fDatatypeValidator = DatatypeValidator::loadDV(serEng);
@@ -1022,10 +1058,28 @@
serEng>>fAttList;
/***
- * TO DO: once SchemaElementDecl is done
+ *
* Deserialize RefVectorOf<SchemaElementDecl>* fElements;
*
***/
+ if (serEng.needToReadTemplateObject((void**)&fElements))
+ {
+ if (!fElements)
+ {
+ fElements = new (fMemoryManager) RefVectorOf<SchemaElementDecl>(8,
true, fMemoryManager);
+ }
+
+ serEng.registerTemplateObject(fElements);
+
+ int vectorLength = 0;
+ serEng>>vectorLength;
+ for ( int i = 0 ; i < vectorLength; i++)
+ {
+ SchemaElementDecl* node;
+ serEng>>node;
+ fElements->addElement(node);
+ }
+ }
/***
*
@@ -1083,17 +1137,42 @@
* fFormattedModel;
*
***/
+ fContentModel = 0;
+ fFormattedModel = 0;
- fContentModel = 0;
- fFormattedModel = 0;
+ /***
+ *
+ * fContentSpecOrgURI: start of the array
+ * fContentSpecOrgURISize: size of the array
+ * fUniqueURI: the current last element in the array
+ *
+ * TODO: could we treat this the same way as fContentModel?
+ *
+ ***/
+ int i;
+ serEng>>i;
- unsigned int i;
+ if (i==1)
+ {
+ serEng>>fContentSpecOrgURISize;
+ serEng>>fUniqueURI;
- serEng>>i;
- *fContentSpecOrgURI = i;
+ if (!fContentSpecOrgURI)
+ {
+ fContentSpecOrgURI = (unsigned int*) fMemoryManager->allocate
+ (fContentSpecOrgURISize * sizeof(unsigned int));
+ }
- serEng>>fUniqueURI;
- serEng>>fContentSpecOrgURISize;
+ unsigned int* tempURI = fContentSpecOrgURI;
+ for (unsigned int i = 0 ; i < fUniqueURI; i++)
+ {
+ unsigned int val;
+ serEng>>val;
+ *tempURI = val;
+ tempURI++;
+ }
+ }
+ //else do nothing
/***
* don't serialize
1.12 +171 -0 xml-xerces/c/src/xercesc/validators/schema/SchemaElementDecl.cpp
Index: SchemaElementDecl.cpp
===================================================================
RCS file:
/home/cvs/xml-xerces/c/src/xercesc/validators/schema/SchemaElementDecl.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- SchemaElementDecl.cpp 5 Oct 2003 02:08:05 -0000 1.11
+++ SchemaElementDecl.cpp 14 Oct 2003 15:22:28 -0000 1.12
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.12 2003/10/14 15:22:28 peiyongz
+ * Implementation of Serialization/Deserialization
+ *
* Revision 1.11 2003/10/05 02:08:05 neilg
* Because it makes grammars un-sharable between parsers running on multiple
threads, xsi:type should not be handled by modifying element declarations. Modifying
implementation so it no longer relies on this kind of behaviour; marking methods as
deprecated which imply that xsi:type will be handled in this way. Once their
behaviour is handled elsewhere, these methods should eventually be removed
*
@@ -408,6 +411,174 @@
// 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;
+
+ DatatypeValidator::storeDV(serEng, fDatatypeValidator);
+
+ serEng<<fEnclosingScope;
+ serEng<<fFinalSet;
+ serEng<<fBlockSet;
+ serEng<<fMiscFlags;
+
+ serEng.writeString(fDefaultValue);
+
+ serEng<<fComplexTypeInfo;
+
+ /***
+ *
+ * Serialize RefHash2KeysTableOf<SchemaAttDef>* fAttDefs;
+ *
+ */
+ if (serEng.needToWriteTemplateObject(fAttDefs))
+ {
+ int itemNumber = 0;
+
+ RefHash2KeysTableOfEnumerator<SchemaAttDef> e(fAttDefs);
+ while (e.hasMoreElements())
+ {
+ e.nextElement();
+ itemNumber++;
+ }
+
+ serEng<<itemNumber;
+
+ e.Reset();
+ while (e.hasMoreElements())
+ {
+ SchemaAttDef& curAttDef = e.nextElement();
+ curAttDef.serialize(serEng);
+ }
+
+ }
+
+
+ serEng<<fXsiComplexTypeInfo;
+
+ DatatypeValidator::storeDV(serEng, (DatatypeValidator*)fXsiSimpleTypeInfo);
+
+ /***
+ *
+ * Serialize RefVectorOf<IdentityConstraint>* fIdentityConstraints;
+ *
+ */
+ if (serEng.needToWriteTemplateObject(fIdentityConstraints))
+ {
+ int vectorLength = fIdentityConstraints->size();
+ serEng<<vectorLength;
+
+ for ( int i = 0 ; i < vectorLength; i++)
+ {
+ IdentityConstraint::storeIC(serEng,
fIdentityConstraints->elementAt(i));
+ }
+ }
+
+ 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;
+ *
+ */
+ if (serEng.needToReadTemplateObject((void**)&fAttDefs))
+ {
+ if (!fAttDefs)
+ {
+ fAttDefs = new
(getMemoryManager())RefHash2KeysTableOf<SchemaAttDef>(3, true, getMemoryManager());
+ }
+
+ serEng.registerTemplateObject(fAttDefs);
+
+ int itemNumber = 0;
+ serEng>>itemNumber;
+
+ for (int itemIndex = 0; itemIndex < itemNumber; itemIndex++)
+ {
+ SchemaAttDef* data = new SchemaAttDef();
+ data->serialize(serEng);
+ fAttDefs->put(data->getAttName()->getLocalPart(), data->getId(),
data);
+ }
+ }
+
+ serEng>>fXsiComplexTypeInfo;
+
+ fXsiSimpleTypeInfo = DatatypeValidator::loadDV(serEng);
+
+ /***
+ *
+ * DeSerialize RefVectorOf<IdentityConstraint>* fIdentityConstraints;
+ *
+ */
+ if (serEng.needToReadTemplateObject((void**)&fIdentityConstraints))
+ {
+ if (!fIdentityConstraints)
+ {
+ fIdentityConstraints = new (getMemoryManager())
RefVectorOf<IdentityConstraint>(8, true, getMemoryManager());
+ }
+
+ serEng.registerTemplateObject(fIdentityConstraints);
+
+ int vectorLength = 0;
+ serEng>>vectorLength;
+ for ( int i = 0 ; i < vectorLength; i++)
+ {
+ IdentityConstraint* node = IdentityConstraint::loadIC(serEng);
;
+ fIdentityConstraints->addElement(node);
+ }
+ }
+
+ serEng>>fAttWildCard;
+ serEng>>fSubstitutionGroupElem;
+
+ serEng>>i;
+ fValidity = (PSVIDefs::Validity)i;
+
+ serEng>> i;
+ fValidation = (PSVIDefs::Validation)i;
+ serEng>>fSeenValidation;
+ serEng>>fSeenNoValidation;
+ serEng>>fHadContent;
+
+ }
+
}
XERCES_CPP_NAMESPACE_END
1.14 +8 -0 xml-xerces/c/src/xercesc/validators/schema/SchemaElementDecl.hpp
Index: SchemaElementDecl.hpp
===================================================================
RCS file:
/home/cvs/xml-xerces/c/src/xercesc/validators/schema/SchemaElementDecl.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- SchemaElementDecl.hpp 5 Oct 2003 02:08:05 -0000 1.13
+++ SchemaElementDecl.hpp 14 Oct 2003 15:22:28 -0000 1.14
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.14 2003/10/14 15:22:28 peiyongz
+ * Implementation of Serialization/Deserialization
+ *
* Revision 1.13 2003/10/05 02:08:05 neilg
* Because it makes grammars un-sharable between parsers running on multiple
threads, xsi:type should not be handled by modifying element declarations. Modifying
implementation so it no longer relies on this kind of behaviour; marking methods as
deprecated which imply that xsi:type will be handled in this way. Once their
behaviour is handled elsewhere, these methods should eventually be removed
*
@@ -394,6 +397,11 @@
void addIdentityConstraint(IdentityConstraint* const ic);
unsigned int getIdentityConstraintCount() const;
IdentityConstraint* getIdentityConstraintAt(unsigned int index) const;
+
+ /***
+ * Support for Serialization/De-serialization
+ ***/
+ DECL_XSERIALIZABLE(SchemaElementDecl)
private :
// -----------------------------------------------------------------------
1.10 +127 -0 xml-xerces/c/src/xercesc/validators/schema/SchemaGrammar.cpp
Index: SchemaGrammar.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/SchemaGrammar.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SchemaGrammar.cpp 1 Oct 2003 16:32:42 -0000 1.9
+++ SchemaGrammar.cpp 14 Oct 2003 15:22:28 -0000 1.10
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.10 2003/10/14 15:22:28 peiyongz
+ * Implementation of Serialization/Deserialization
+ *
* Revision 1.9 2003/10/01 16:32:42 neilg
* improve handling of out of memory conditions, bug #23415. Thanks to David
Cargill.
*
@@ -313,6 +316,130 @@
XMLGrammarDescription* SchemaGrammar::getGrammarDescription() const
{
return fGramDesc;
+}
+
+/***
+ * Support for Serialization/De-serialization
+ ***/
+
+IMPL_XSERIALIZABLE_TOCREATE(SchemaGrammar)
+
+void SchemaGrammar::serialize(XSerializeEngine& serEng)
+{
+
+ Grammar::serialize(serEng);
+
+ /***
+ XMLCh* fTargetNamespace;
+ RefHash3KeysIdPool<SchemaElementDecl>* fElemDeclPool;
+ RefHash3KeysIdPool<SchemaElementDecl>* fElemNonDeclPool;
+ RefHash3KeysIdPool<SchemaElementDecl>* fGroupElemDeclPool;
+ NameIdPool<XMLNotationDecl>* fNotationDeclPool;
+ RefHashTableOf<XMLAttDef>* fAttributeDeclRegistry;
+ RefHashTableOf<ComplexTypeInfo>* fComplexTypeRegistry;
+ RefHashTableOf<XercesGroupInfo>* fGroupInfoRegistry;
+ RefHashTableOf<XercesAttGroupInfo>* fAttGroupInfoRegistry;
+ NamespaceScope* fNamespaceScope;
+ RefHash2KeysTableOf<ElemVector>* fValidSubstitutionGroups;
+ RefHashTableOf<XMLRefInfo>* fIDRefList;
+ MemoryManager* fMemoryManager;
+ bool fValidated;
+ DatatypeValidatorFactory fDatatypeRegistry;
+ XMLSchemaDescription* fGramDesc;
+ ***/
+
+ if (serEng.isStoring())
+ {
+ serEng.writeString(fTargetNamespace);
+
+ /***
+ *
+ * Serialize RefHash3KeysIdPool<SchemaElementDecl>* fElemDeclPool;
+ *
+ ***/
+ if (serEng.needToWriteTemplateObject(fElemDeclPool))
+ {
+ int itemNumber = 0;
+ RefHash3KeysIdPoolEnumerator<SchemaElementDecl> e(fElemDeclPool);
+
+ while (e.hasMoreElements())
+ {
+ e.nextElement();
+ itemNumber++;
+ }
+
+ serEng<<itemNumber;
+
+ e.Reset();
+ while (e.hasMoreElements())
+ {
+ SchemaElementDecl& curElem = e.nextElement();
+ curElem.serialize(serEng);
+ }
+
+ }
+
+ /***
+ *
+ * Serialize RefHash3KeysIdPool<SchemaElementDecl>* fElemNonDeclPool;
+ * TODO: will this data be removed
+ ***/
+ if (serEng.needToWriteTemplateObject(fElemDeclPool))
+ {
+ int itemNumber = 0;
+ RefHash3KeysIdPoolEnumerator<SchemaElementDecl> e(fElemDeclPool);
+
+ while (e.hasMoreElements())
+ {
+ e.nextElement();
+ itemNumber++;
+ }
+
+ serEng<<itemNumber;
+
+ e.Reset();
+ while (e.hasMoreElements())
+ {
+ SchemaElementDecl& curElem = e.nextElement();
+ curElem.serialize(serEng);
+ }
+
+ }
+
+ /***
+ *
+ * Serialize RefHash3KeysIdPool<SchemaElementDecl>* fGroupElemDeclPool;
+ *
+ ***/
+ }
+ else
+ {
+ /***
+ *
+ * Deserialize RefHash3KeysIdPool<SchemaElementDecl>* fElemDeclPool;
+ *
+ ***/
+ if (serEng.needToReadTemplateObject((void**)&fElemDeclPool))
+ {
+ if (!fElemDeclPool)
+ {
+ fElemDeclPool = new (serEng.getMemoryManager())
RefHash3KeysIdPool<SchemaElementDecl>(109, true, 128, serEng.getMemoryManager());
+ }
+
+ serEng.registerTemplateObject(fElemDeclPool);
+
+ int itemNumber = 0;
+ serEng>>itemNumber;
+
+ for (int itemIndex = 0; itemIndex < itemNumber; itemIndex++)
+ {
+ SchemaElementDecl* elemDecl = new (fMemoryManager)
SchemaElementDecl(fMemoryManager);
+ elemDecl->serialize(serEng);
+ fElemDeclPool->put(elemDecl->getBaseName(), elemDecl->getURI(),
elemDecl->getEnclosingScope(), elemDecl);
+ }
+ }
+
+ }
}
XERCES_CPP_NAMESPACE_END
1.10 +8 -0 xml-xerces/c/src/xercesc/validators/schema/SchemaGrammar.hpp
Index: SchemaGrammar.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/SchemaGrammar.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SchemaGrammar.hpp 22 Sep 2003 19:49:03 -0000 1.9
+++ SchemaGrammar.hpp 14 Oct 2003 15:22:28 -0000 1.10
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.10 2003/10/14 15:22:28 peiyongz
+ * Implementation of Serialization/Deserialization
+ *
* Revision 1.9 2003/09/22 19:49:03 neilg
* implement change to Grammar::putElem(XMLElementDecl, bool). If Grammars are
used only to hold declared objects, there will be no need for the fElemNonDeclPool
tables; make Grammar implementations lazily create them only if the application
requires them (which good cpplications should not.)
*
@@ -299,6 +302,11 @@
(
XMLElementDecl* const elemDecl
) const;
+
+ /***
+ * Support for Serialization/De-serialization
+ ***/
+ DECL_XSERIALIZABLE(SchemaGrammar)
private:
1.5 +107 -0
xml-xerces/c/src/xercesc/validators/schema/XercesAttGroupInfo.cpp
Index: XercesAttGroupInfo.cpp
===================================================================
RCS file:
/home/cvs/xml-xerces/c/src/xercesc/validators/schema/XercesAttGroupInfo.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XercesAttGroupInfo.cpp 15 May 2003 18:57:27 -0000 1.4
+++ XercesAttGroupInfo.cpp 14 Oct 2003 15:22:28 -0000 1.5
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.5 2003/10/14 15:22:28 peiyongz
+ * Implementation of Serialization/Deserialization
+ *
* Revision 1.4 2003/05/15 18:57:27 knoaman
* Partial implementation of the configurable memory manager.
*
@@ -160,6 +163,110 @@
}
return 0;
+}
+
+/***
+ * Support for Serialization/De-serialization
+ ***/
+
+IMPL_XSERIALIZABLE_TOCREATE(XercesAttGroupInfo)
+
+void XercesAttGroupInfo::serialize(XSerializeEngine& serEng)
+{
+
+ if (serEng.isStoring())
+ {
+ serEng<<fTypeWithId;
+
+ /***
+ *
+ * Serialize RefVectorOf<SchemaAttDef>* fAttributes;
+ *
+ ***/
+ if (serEng.needToWriteTemplateObject(fAttributes))
+ {
+ int vectorLength = fAttributes->size();
+ serEng<<vectorLength;
+
+ for ( int i = 0 ; i < vectorLength; i++)
+ {
+ serEng<<fAttributes->elementAt(i);
+ }
+ }
+
+ /***
+ *
+ * Serialize RefVectorOf<SchemaAttDef>* fAnyAttributes;
+ *
+ ***/
+ if (serEng.needToWriteTemplateObject(fAnyAttributes))
+ {
+ int vectorLength = fAnyAttributes->size();
+ serEng<<vectorLength;
+
+ for ( int i = 0 ; i < vectorLength; i++)
+ {
+ serEng<<fAnyAttributes->elementAt(i);
+ }
+ }
+
+ serEng<<fCompleteWildCard;
+ }
+ else
+ {
+ serEng>>fTypeWithId;
+
+ /***
+ *
+ * Deserialize RefVectorOf<SchemaAttDef>* fAttributes;
+ *
+ ***/
+ if (serEng.needToReadTemplateObject((void**)&fAttributes))
+ {
+ if (!fAttributes)
+ {
+ fAttributes = new (fMemoryManager) RefVectorOf<SchemaAttDef>(8,
true, fMemoryManager);
+ }
+
+ serEng.registerTemplateObject(fAttributes);
+
+ int vectorLength = 0;
+ serEng>>vectorLength;
+ for ( int i = 0 ; i < vectorLength; i++)
+ {
+ SchemaAttDef* node;
+ serEng>>node;
+ fAttributes->addElement(node);
+ }
+ }
+
+ /***
+ *
+ * Deserialize RefVectorOf<SchemaAttDef>* fAnyAttributes;
+ *
+ ***/
+ if (serEng.needToReadTemplateObject((void**)&fAnyAttributes))
+ {
+ if (!fAnyAttributes)
+ {
+ fAnyAttributes = new (fMemoryManager) RefVectorOf<SchemaAttDef>(8,
true, fMemoryManager);
+ }
+
+ serEng.registerTemplateObject(fAnyAttributes);
+
+ int vectorLength = 0;
+ serEng>>vectorLength;
+ for ( int i = 0 ; i < vectorLength; i++)
+ {
+ SchemaAttDef* node;
+ serEng>>node;
+ fAnyAttributes->addElement(node);
+ }
+ }
+
+ serEng>>fCompleteWildCard;
+ }
+
}
XERCES_CPP_NAMESPACE_END
1.6 +9 -2
xml-xerces/c/src/xercesc/validators/schema/XercesAttGroupInfo.hpp
Index: XercesAttGroupInfo.hpp
===================================================================
RCS file:
/home/cvs/xml-xerces/c/src/xercesc/validators/schema/XercesAttGroupInfo.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XercesAttGroupInfo.hpp 18 May 2003 14:02:08 -0000 1.5
+++ XercesAttGroupInfo.hpp 14 Oct 2003 15:22:28 -0000 1.6
@@ -74,9 +74,11 @@
#include <xercesc/util/RefVectorOf.hpp>
#include <xercesc/validators/schema/SchemaAttDef.hpp>
+#include <xercesc/internal/XSerializable.hpp>
+
XERCES_CPP_NAMESPACE_BEGIN
-class VALIDATORS_EXPORT XercesAttGroupInfo : public XMemory
+class VALIDATORS_EXPORT XercesAttGroupInfo : public XSerializable, public XMemory
{
public:
// -----------------------------------------------------------------------
@@ -111,6 +113,11 @@
// Query methods
// -----------------------------------------------------------------------
bool containsAttribute(const XMLCh* const name, const unsigned int uri);
+
+ /***
+ * Support for Serialization/De-serialization
+ ***/
+ DECL_XSERIALIZABLE(XercesAttGroupInfo)
private:
// -----------------------------------------------------------------------
1.7 +76 -0 xml-xerces/c/src/xercesc/validators/schema/XercesGroupInfo.cpp
Index: XercesGroupInfo.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/XercesGroupInfo.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XercesGroupInfo.cpp 18 May 2003 14:02:08 -0000 1.6
+++ XercesGroupInfo.cpp 14 Oct 2003 15:22:28 -0000 1.7
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.7 2003/10/14 15:22:28 peiyongz
+ * Implementation of Serialization/Deserialization
+ *
* Revision 1.6 2003/05/18 14:02:08 knoaman
* Memory manager implementation: pass per instance manager.
*
@@ -123,6 +126,79 @@
delete fLocator;
fLocator = aLocator;
+}
+
+/***
+ * Support for Serialization/De-serialization
+ ***/
+
+IMPL_XSERIALIZABLE_TOCREATE(XercesGroupInfo)
+
+void XercesGroupInfo::serialize(XSerializeEngine& serEng)
+{
+
+ if (serEng.isStoring())
+ {
+ serEng<<fCheckElementConsistency;
+ serEng<<fScope;
+ serEng<<fContentSpec;
+
+ /***
+ *
+ * Serialize RefVectorOf<SchemaElementDecl>* fElements;
+ *
+ ***/
+ if (serEng.needToWriteTemplateObject(fElements))
+ {
+ int vectorLength = fElements->size();
+ serEng<<vectorLength;
+
+ for ( int i = 0 ; i < vectorLength; i++)
+ {
+ serEng<<fElements->elementAt(i);
+ }
+ }
+
+ serEng<<fBaseGroup;
+
+ //don't serialize XSDLocator* fLocator;
+ }
+ else
+ {
+ serEng>>fCheckElementConsistency;
+ serEng>>fScope;
+ serEng>>fContentSpec;
+
+ /***
+ *
+ * Deserialize RefVectorOf<SchemaElementDecl>* fElements;
+ *
+ ***/
+ if (serEng.needToReadTemplateObject((void**)&fElements))
+ {
+ if (!fElements)
+ {
+ fElements = new (serEng.getMemoryManager())
RefVectorOf<SchemaElementDecl>(8, true, serEng.getMemoryManager());
+ }
+
+ serEng.registerTemplateObject(fElements);
+
+ int vectorLength = 0;
+ serEng>>vectorLength;
+ for ( int i = 0 ; i < vectorLength; i++)
+ {
+ SchemaElementDecl* node;
+ serEng>>node;
+ fElements->addElement(node);
+ }
+ }
+
+ serEng>>fBaseGroup;
+
+ //don't serialize XSDLocator* fLocator;
+ fLocator = 0;
+ }
+
}
XERCES_CPP_NAMESPACE_END
1.7 +9 -2 xml-xerces/c/src/xercesc/validators/schema/XercesGroupInfo.hpp
Index: XercesGroupInfo.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/XercesGroupInfo.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XercesGroupInfo.hpp 16 May 2003 21:43:21 -0000 1.6
+++ XercesGroupInfo.hpp 14 Oct 2003 15:22:28 -0000 1.7
@@ -74,6 +74,8 @@
#include <xercesc/util/RefVectorOf.hpp>
#include <xercesc/validators/schema/SchemaElementDecl.hpp>
+#include <xercesc/internal/XSerializable.hpp>
+
XERCES_CPP_NAMESPACE_BEGIN
// ---------------------------------------------------------------------------
@@ -83,7 +85,7 @@
class XSDLocator;
-class VALIDATORS_EXPORT XercesGroupInfo : public XMemory
+class VALIDATORS_EXPORT XercesGroupInfo : public XSerializable, public XMemory
{
public:
// -----------------------------------------------------------------------
@@ -113,6 +115,11 @@
void setLocator(XSDLocator* const aLocator);
void setBaseGroup(XercesGroupInfo* const baseGroup);
void setCheckElementConsistency(const bool aValue);
+
+ /***
+ * Support for Serialization/De-serialization
+ ***/
+ DECL_XSERIALIZABLE(XercesGroupInfo)
private:
// -----------------------------------------------------------------------
1.4 +102 -1
xml-xerces/c/src/xercesc/validators/schema/XMLSchemaDescriptionImpl.cpp
Index: XMLSchemaDescriptionImpl.cpp
===================================================================
RCS file:
/home/cvs/xml-xerces/c/src/xercesc/validators/schema/XMLSchemaDescriptionImpl.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XMLSchemaDescriptionImpl.cpp 31 Jul 2003 17:14:27 -0000 1.3
+++ XMLSchemaDescriptionImpl.cpp 14 Oct 2003 15:22:28 -0000 1.4
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.4 2003/10/14 15:22:28 peiyongz
+ * Implementation of Serialization/Deserialization
+ *
* Revision 1.3 2003/07/31 17:14:27 peiyongz
* Grammar embed grammar description
*
@@ -194,6 +197,104 @@
// 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<XMLCh>* fLocationHints;
+ *
+ ***/
+ if (serEng.needToWriteTemplateObject(fLocationHints))
+ {
+ int enumLength = fLocationHints->size();
+ serEng<<enumLength;
+
+ for ( int i = 0 ; i < enumLength; i++)
+ {
+ serEng.writeString(fLocationHints->elementAt(i));
+ }
+ }
+
+ 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;
+ serEng.readString((XMLCh*&)fNamespace);
+
+ /***
+ *
+ * Deserialize RefArrayVectorOf<XMLCh> fLocationHints
+ *
+ ***/
+ if (serEng.needToReadTemplateObject((void**)&fLocationHints))
+ {
+ if (!fLocationHints)
+ {
+ fLocationHints = new (XMLGrammarDescription::getMemoryManager())
RefArrayVectorOf<XMLCh>(4, true, XMLGrammarDescription::getMemoryManager());
+ }
+
+ serEng.registerTemplateObject(fLocationHints);
+
+ int enumLength = 0;
+ serEng>>enumLength;
+ for ( int i = 0; i < enumLength; i++)
+ {
+ XMLCh* enumVal;
+ serEng.readString(enumVal);
+ fLocationHints->addElement(enumVal);
+ }
+ }
+
+ 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
1.3 +11 -1
xml-xerces/c/src/xercesc/validators/schema/XMLSchemaDescriptionImpl.hpp
Index: XMLSchemaDescriptionImpl.hpp
===================================================================
RCS file:
/home/cvs/xml-xerces/c/src/xercesc/validators/schema/XMLSchemaDescriptionImpl.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XMLSchemaDescriptionImpl.hpp 31 Jul 2003 17:14:27 -0000 1.2
+++ XMLSchemaDescriptionImpl.hpp 14 Oct 2003 15:22:28 -0000 1.3
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.3 2003/10/14 15:22:28 peiyongz
+ * Implementation of Serialization/Deserialization
+ *
* Revision 1.2 2003/07/31 17:14:27 peiyongz
* Grammar embed grammar description
*
@@ -179,6 +182,13 @@
*/
virtual void setAttributes(XMLAttDef* const);
//@}
+
+ /***
+ * Support for Serialization/De-serialization
+ ***/
+ DECL_XSERIALIZABLE(XMLSchemaDescriptionImpl)
+
+ XMLSchemaDescriptionImpl(MemoryManager* const memMgr =
XMLPlatformUtils::fgMemoryManager);
private :
// -----------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]