peiyongz 2003/11/05 08:37:18 Modified: c/src/xercesc/validators/datatype DatatypeValidator.cpp DatatypeValidator.hpp Log: don't serialize built-in baseValidator, and don't serialize localName/uriName Revision Changes Path 1.14 +60 -11 xml-xerces/c/src/xercesc/validators/datatype/DatatypeValidator.cpp Index: DatatypeValidator.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/DatatypeValidator.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- DatatypeValidator.cpp 17 Oct 2003 21:13:44 -0000 1.13 +++ DatatypeValidator.cpp 5 Nov 2003 16:37:18 -0000 1.14 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.14 2003/11/05 16:37:18 peiyongz + * don't serialize built-in baseValidator, and don't serialize localName/uriName + * * Revision 1.13 2003/10/17 21:13:44 peiyongz * using XTemplateSerializer * @@ -311,7 +314,19 @@ serEng<<fFixed; serEng<<(int)fType; - storeDV(serEng, fBaseValidator); + /*** + * 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> @@ -321,17 +336,16 @@ serEng.writeString(fPattern); /*** - * don't serialize fRegex + * don't serialize + * fRegex + * fTypeLocalName + * fTypeUri ***/ - serEng.writeString(fTypeName); - serEng.writeString(fTypeLocalName); - serEng.writeString(fTypeUri); + } else { - int dataLen = 0; - serEng>>fAnonymous; serEng>>fWhiteSpace; serEng>>fFinalSet; @@ -347,7 +361,28 @@ * get the basevalidator's type * ***/ - fBaseValidator = loadDV(serEng); + 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); + } /*** * @@ -363,9 +398,16 @@ ***/ fRegex = 0; - serEng.readString(fTypeName); - serEng.readString((XMLCh*&)fTypeLocalName); - serEng.readString((XMLCh*&)fTypeUri); + /*** + * Recreate through setTypeName() + * fTypeName + * fTypeLocalName + * fTypeUri + ***/ + XMLCh* typeName; + serEng.readString(typeName); + ArrayJanitor<XMLCh> janName(typeName, fMemoryManager); + setTypeName(typeName); } @@ -552,6 +594,13 @@ break; } +} + +inline bool +DatatypeValidator::isBuiltInDV(DatatypeValidator* const dv) +{ + return dv? DatatypeValidatorFactory::getBuiltInRegistry()->containsKey(dv->getTypeName()) + : false; } XERCES_CPP_NAMESPACE_END 1.16 +5 -4 xml-xerces/c/src/xercesc/validators/datatype/DatatypeValidator.hpp Index: DatatypeValidator.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/DatatypeValidator.hpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- DatatypeValidator.hpp 7 Oct 2003 19:39:37 -0000 1.15 +++ DatatypeValidator.hpp 5 Nov 2003 16:37:18 -0000 1.16 @@ -427,7 +427,9 @@ // ----------------------------------------------------------------------- // CleanUp methods // ----------------------------------------------------------------------- - void cleanUp(); + void cleanUp(); + + bool isBuiltInDV(DatatypeValidator* const); // ----------------------------------------------------------------------- // Private data members @@ -539,7 +541,7 @@ inline const XMLCh* DatatypeValidator::getTypeName() const { - return fTypeLocalName; + return fTypeName; } inline bool DatatypeValidator::getAnonymous() const @@ -634,7 +636,6 @@ return false; } - XERCES_CPP_NAMESPACE_END
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]