diff --git a/src/xercesc/internal/IGXMLScanner2.cpp b/src/xercesc/internal/IGXMLScanner2.cpp index b571ffa9d91fcb9713d5345213865e1c6b515668..dd196fb4d8ec9fcd3385eacf5334655ae9486c49 100644 --- a/src/xercesc/internal/IGXMLScanner2.cpp +++ b/src/xercesc/internal/IGXMLScanner2.cpp @@ -366,13 +366,16 @@ IGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs // If we found an attdef for this one, then lets validate it. if (fNormalizeData) { - // normalize the attribute according to schema whitespace facet - XMLBufBid bbtemp(&fBufMgr); - XMLBuffer& tempBuf = bbtemp.getBuffer(); - DatatypeValidator* tempDV = ((SchemaAttDef*) attDefForWildCard)->getDatatypeValidator(); - ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, normBuf.getRawBuffer(), tempBuf); - normBuf.set(tempBuf.getRawBuffer()); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the attribute according to schema whitespace facet + XMLBufBid bbtemp(&fBufMgr); + XMLBuffer& tempBuf = bbtemp.getBuffer(); + + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, normBuf.getRawBuffer(), tempBuf); + normBuf.set(tempBuf.getRawBuffer()); + } } if (fValidate && !skipThisOne) { @@ -408,13 +411,16 @@ IGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs { if (fNormalizeData && (fGrammarType == Grammar::SchemaGrammarType)) { - // normalize the attribute according to schema whitespace facet - XMLBufBid bbtemp(&fBufMgr); - XMLBuffer& tempBuf = bbtemp.getBuffer(); - DatatypeValidator* tempDV = ((SchemaAttDef*) attDef)->getDatatypeValidator(); - ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, normBuf.getRawBuffer(), tempBuf); - normBuf.set(tempBuf.getRawBuffer()); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the attribute according to schema whitespace facet + XMLBufBid bbtemp(&fBufMgr); + XMLBuffer& tempBuf = bbtemp.getBuffer(); + + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, normBuf.getRawBuffer(), tempBuf); + normBuf.set(tempBuf.getRawBuffer()); + } } if (fValidate && !skipThisOne) @@ -651,7 +657,6 @@ bool IGXMLScanner::normalizeAttValue( const XMLAttDef* const attDef // Get the type and name const XMLAttDef::AttTypes type = attDef->getType(); - const XMLCh* const attrName = attDef->getFullName(); // Assume its going to go fine, and empty the target buffer in preperation bool retVal = true; @@ -681,7 +686,7 @@ bool IGXMLScanner::normalizeAttValue( const XMLAttDef* const attDef // not allowed in attribute values. if (!escaped && (*srcPtr == chOpenAngle)) { - emitError(XMLErrs::BracketInAttrValue, attrName); + emitError(XMLErrs::BracketInAttrValue, attDef->getFullName()); retVal = false; } @@ -697,7 +702,7 @@ bool IGXMLScanner::normalizeAttValue( const XMLAttDef* const attDef { // Can't have a standalone document declaration of "yes" if attribute // values are subject to normalisation - fValidator->emitError(XMLValid::NoAttNormForStandalone, attrName); + fValidator->emitError(XMLValid::NoAttNormForStandalone, attDef->getFullName()); if(fGrammarType == Grammar::SchemaGrammarType) { ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::INVALID); } @@ -739,7 +744,7 @@ bool IGXMLScanner::normalizeAttValue( const XMLAttDef* const attDef { // Can't have a standalone document declaration of "yes" if attribute // values are subject to normalisation - fValidator->emitError(XMLValid::NoAttNormForStandalone, attrName); + fValidator->emitError(XMLValid::NoAttNormForStandalone, attDef->getFullName()); if(fGrammarType == Grammar::SchemaGrammarType) { ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::INVALID); } @@ -1054,14 +1059,18 @@ void IGXMLScanner::sendCharData(XMLBuffer& toSend) else { if (fNormalizeData) { - // normalize the character according to schema whitespace facet - XMLBufBid bbtemp(&fBufMgr); - XMLBuffer& tempBuf = bbtemp.getBuffer(); DatatypeValidator* tempDV = ((SchemaElementDecl*) topElem->fThisElement)->getDatatypeValidator(); - ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, rawBuf, tempBuf); - rawBuf = tempBuf.getRawBuffer(); - len = tempBuf.getLen(); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the character according to schema whitespace facet + XMLBufBid bbtemp(&fBufMgr); + XMLBuffer& tempBuf = bbtemp.getBuffer(); + + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, rawBuf, tempBuf); + rawBuf = tempBuf.getRawBuffer(); + len = tempBuf.getLen(); + } } // tell the schema validation about the character data for checkContent later @@ -1091,14 +1100,18 @@ void IGXMLScanner::sendCharData(XMLBuffer& toSend) else { if (fNormalizeData) { - // normalize the character according to schema whitespace facet - XMLBufBid bbtemp(&fBufMgr); - XMLBuffer& tempBuf = bbtemp.getBuffer(); DatatypeValidator* tempDV = ((SchemaElementDecl*) topElem->fThisElement)->getDatatypeValidator(); - ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, rawBuf, tempBuf); - rawBuf = tempBuf.getRawBuffer(); - len = tempBuf.getLen(); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the character according to schema whitespace facet + XMLBufBid bbtemp(&fBufMgr); + XMLBuffer& tempBuf = bbtemp.getBuffer(); + + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, rawBuf, tempBuf); + rawBuf = tempBuf.getRawBuffer(); + len = tempBuf.getLen(); + } } // tell the schema validation about the character data for checkContent later @@ -2100,14 +2113,18 @@ void IGXMLScanner::scanCDSection() if (fGrammarType == Grammar::SchemaGrammarType) { - if (fNormalizeData) { - // normalize the character according to schema whitespace facet - XMLBufBid bbtemp(&fBufMgr); - XMLBuffer& tempBuf = bbtemp.getBuffer(); - + if (fNormalizeData) + { DatatypeValidator* tempDV = ((SchemaElementDecl*) topElem->fThisElement)->getDatatypeValidator(); - ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, bbCData.getRawBuffer(), tempBuf); - bbCData.set(tempBuf.getRawBuffer()); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the character according to schema whitespace facet + XMLBufBid bbtemp(&fBufMgr); + XMLBuffer& tempBuf = bbtemp.getBuffer(); + + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, bbCData.getRawBuffer(), tempBuf); + bbCData.set(tempBuf.getRawBuffer()); + } } if (fValidate) { diff --git a/src/xercesc/internal/SGXMLScanner.cpp b/src/xercesc/internal/SGXMLScanner.cpp index 401c644cce0e1cb439279399c3edf65a4986ad24..37d458aae9396147f6d0485735c3ec01412a83a2 100644 --- a/src/xercesc/internal/SGXMLScanner.cpp +++ b/src/xercesc/internal/SGXMLScanner.cpp @@ -2228,13 +2228,16 @@ SGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs // If we found an attdef for this one, then lets validate it. if (fNormalizeData) { - // normalize the attribute according to schema whitespace facet - XMLBufBid bbtemp(&fBufMgr); - XMLBuffer& tempBuf = bbtemp.getBuffer(); - DatatypeValidator* tempDV = ((SchemaAttDef*) attDefForWildCard)->getDatatypeValidator(); - ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, normBuf.getRawBuffer(), tempBuf); - normBuf.set(tempBuf.getRawBuffer()); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the attribute according to schema whitespace facet + XMLBufBid bbtemp(&fBufMgr); + XMLBuffer& tempBuf = bbtemp.getBuffer(); + + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, normBuf.getRawBuffer(), tempBuf); + normBuf.set(tempBuf.getRawBuffer()); + } } if (fValidate && !skipThisOne) { @@ -2268,13 +2271,16 @@ SGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs { if (fNormalizeData && (fGrammarType == Grammar::SchemaGrammarType)) { - // normalize the attribute according to schema whitespace facet - XMLBufBid bbtemp(&fBufMgr); - XMLBuffer& tempBuf = bbtemp.getBuffer(); - DatatypeValidator* tempDV = ((SchemaAttDef*) attDef)->getDatatypeValidator(); - ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, normBuf.getRawBuffer(), tempBuf); - normBuf.set(tempBuf.getRawBuffer()); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the attribute according to schema whitespace facet + XMLBufBid bbtemp(&fBufMgr); + XMLBuffer& tempBuf = bbtemp.getBuffer(); + + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, normBuf.getRawBuffer(), tempBuf); + normBuf.set(tempBuf.getRawBuffer()); + } } if (fValidate && !skipThisOne) @@ -2844,14 +2850,18 @@ void SGXMLScanner::sendCharData(XMLBuffer& toSend) XMLBuffer toFill(len+1, fMemoryManager); toFill.set(rawBuf); - if (fNormalizeData) { - // normalize the character according to schema whitespace facet - XMLBufBid bbtemp(&fBufMgr); - XMLBuffer& tempBuf = bbtemp.getBuffer(); - + if (fNormalizeData) + { DatatypeValidator* tempDV = ((SchemaElementDecl*) topElem->fThisElement)->getDatatypeValidator(); - ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, toFill.getRawBuffer(), tempBuf); - toFill.set(tempBuf.getRawBuffer()); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the character according to schema whitespace facet + XMLBufBid bbtemp(&fBufMgr); + XMLBuffer& tempBuf = bbtemp.getBuffer(); + + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, toFill.getRawBuffer(), tempBuf); + toFill.set(tempBuf.getRawBuffer()); + } } // tell the schema validation about the character data for checkContent later @@ -2878,14 +2888,18 @@ void SGXMLScanner::sendCharData(XMLBuffer& toSend) XMLBuffer toFill(len+1, fMemoryManager); toFill.set(rawBuf); - if (fNormalizeData) { - // normalize the character according to schema whitespace facet - XMLBufBid bbtemp(&fBufMgr); - XMLBuffer& tempBuf = bbtemp.getBuffer(); - + if (fNormalizeData) + { DatatypeValidator* tempDV = ((SchemaElementDecl*) topElem->fThisElement)->getDatatypeValidator(); - ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, toFill.getRawBuffer(), tempBuf); - toFill.set(tempBuf.getRawBuffer()); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the character according to schema whitespace facet + XMLBufBid bbtemp(&fBufMgr); + XMLBuffer& tempBuf = bbtemp.getBuffer(); + + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, toFill.getRawBuffer(), tempBuf); + toFill.set(tempBuf.getRawBuffer()); + } } // tell the schema validation about the character data for checkContent later @@ -3629,14 +3643,18 @@ void SGXMLScanner::scanCDSection() if (fValidate) { - if (fNormalizeData) { - // normalize the character according to schema whitespace facet - XMLBufBid bbtemp(&fBufMgr); - XMLBuffer& tempBuf = bbtemp.getBuffer(); - + if (fNormalizeData) + { DatatypeValidator* tempDV = ((SchemaElementDecl*) topElem->fThisElement)->getDatatypeValidator(); - ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, bbCData.getRawBuffer(), tempBuf); - bbCData.set(tempBuf.getRawBuffer()); + if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE) + { + // normalize the character according to schema whitespace facet + XMLBufBid bbtemp(&fBufMgr); + XMLBuffer& tempBuf = bbtemp.getBuffer(); + + ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, bbCData.getRawBuffer(), tempBuf); + bbCData.set(tempBuf.getRawBuffer()); + } } // tell the schema validation about the character data for checkContent later diff --git a/src/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.cpp b/src/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.cpp index 7d0e99a0d3fb2d42a78d35cf2a250b7f19ae27e5..f76a8b022422401958be666729cd16e84104a566 100644 --- a/src/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.cpp +++ b/src/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.7 2003/10/01 01:09:35 knoaman + * Refactoring of some code to improve performance. + * * Revision 1.6 2003/05/15 18:53:26 knoaman * Partial implementation of the configurable memory manager. * @@ -95,7 +98,7 @@ XERCES_CPP_NAMESPACE_BEGIN AnySimpleTypeDatatypeValidator::AnySimpleTypeDatatypeValidator(MemoryManager* const manager) : DatatypeValidator(0, 0, SchemaSymbols::XSD_RESTRICTION, DatatypeValidator::AnySimpleType, manager) { - + setWhiteSpace(DatatypeValidator::PRESERVE); } AnySimpleTypeDatatypeValidator::~AnySimpleTypeDatatypeValidator() diff --git a/src/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.hpp b/src/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.hpp index 022b6d017080caf9cab29679198cee0cd217a171..9c41713282d82796bad8edd4ae577b8765a1ac2d 100644 --- a/src/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.hpp +++ b/src/xercesc/validators/datatype/AnySimpleTypeDatatypeValidator.hpp @@ -99,12 +99,6 @@ public: /** @name Getter Functions */ //@{ - /** - * Returns default value (collapse) for whiteSpace facet. - * This function is overwritten in StringDatatypeValidator. - */ - short getWSFacet () const; - /** * Returns whether the type is atomic or not */ @@ -174,11 +168,6 @@ public: // --------------------------------------------------------------------------- // DatatypeValidator: Getters // --------------------------------------------------------------------------- -inline short AnySimpleTypeDatatypeValidator::getWSFacet() const { - - return DatatypeValidator::PRESERVE; -} - inline bool AnySimpleTypeDatatypeValidator::isAtomic() const { return false; diff --git a/src/xercesc/validators/datatype/DatatypeValidator.cpp b/src/xercesc/validators/datatype/DatatypeValidator.cpp index 3157c343d16e88d0a159a2325fe453c7cbf79ff0..f9965ca0086a15d84a3a31c2fe7d228dc5a05039 100644 --- a/src/xercesc/validators/datatype/DatatypeValidator.cpp +++ b/src/xercesc/validators/datatype/DatatypeValidator.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.10 2003/10/01 01:09:35 knoaman + * Refactoring of some code to improve performance. + * * Revision 1.9 2003/09/30 21:32:23 peiyongz * AnyURI, Base64, HexBin, NOTATION, List and QName * @@ -159,6 +162,7 @@ DatatypeValidator::DatatypeValidator(DatatypeValidator* const baseValidator, MemoryManager* const manager) : fMemoryManager(manager) , fAnonymous(false) + , fWhiteSpace(COLLAPSE) , fFinalSet(finalSet) , fFacetsDefined(0) , fFixed(0) diff --git a/src/xercesc/validators/datatype/DatatypeValidator.hpp b/src/xercesc/validators/datatype/DatatypeValidator.hpp index 958bfd6b9110feafd7a5df5c2fec4ed2f86b40d3..5e25b235fbcb98924b4ec3472657dadb7982d59d 100644 --- a/src/xercesc/validators/datatype/DatatypeValidator.hpp +++ b/src/xercesc/validators/datatype/DatatypeValidator.hpp @@ -67,7 +67,6 @@ #include <xercesc/util/XMLUniDefs.hpp> #include <xercesc/util/regx/RegularExpression.hpp> #include <xercesc/validators/schema/SchemaSymbols.hpp> - #include <xercesc/internal/XSerializable.hpp> XERCES_CPP_NAMESPACE_BEGIN @@ -183,7 +182,7 @@ public: * Returns default value (collapse) for whiteSpace facet. * This function is overwritten in StringDatatypeValidator. */ - virtual short getWSFacet () const; + short getWSFacet () const; /** * Returns the base datatype validator if set. @@ -378,6 +377,11 @@ protected: */ void setType(ValidatorType); + /** + * set fWhiteSpace + */ + void setWhiteSpace(short); + /** * get WSString */ @@ -442,6 +446,7 @@ private: // // ----------------------------------------------------------------------- bool fAnonymous; + short fWhiteSpace; int fFinalSet; int fFacetsDefined; int fFixed; @@ -476,7 +481,7 @@ inline DatatypeValidator* DatatypeValidator::getBaseValidator() const { inline short DatatypeValidator::getWSFacet() const { - return COLLAPSE; + return fWhiteSpace; } inline DatatypeValidator::ValidatorType DatatypeValidator::getType() const @@ -537,6 +542,11 @@ inline void DatatypeValidator::setType(ValidatorType theType) fType = theType; } +inline void DatatypeValidator::setWhiteSpace(short newValue) +{ + fWhiteSpace = newValue; +} + inline void DatatypeValidator::setFacetsDefined(int facets) { fFacetsDefined |= facets; diff --git a/src/xercesc/validators/datatype/StringDatatypeValidator.cpp b/src/xercesc/validators/datatype/StringDatatypeValidator.cpp index 6160103736338c1bb993e65bb4ed6303b4686b13..666011cfafc04a0780824b5cb3f8e537149bd88d 100644 --- a/src/xercesc/validators/datatype/StringDatatypeValidator.cpp +++ b/src/xercesc/validators/datatype/StringDatatypeValidator.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.8 2003/10/01 01:09:35 knoaman + * Refactoring of some code to improve performance. + * * Revision 1.7 2003/09/30 21:31:37 peiyongz * Implementation of Serialization/Deserialization * @@ -147,8 +150,9 @@ static XMLCh value2[BUF_LEN+1]; // --------------------------------------------------------------------------- StringDatatypeValidator::StringDatatypeValidator(MemoryManager* const manager) :AbstractStringValidator(0, 0, 0, DatatypeValidator::String, manager) -,fWhiteSpace(DatatypeValidator::PRESERVE) -{} +{ + setWhiteSpace(DatatypeValidator::PRESERVE); +} StringDatatypeValidator::StringDatatypeValidator( DatatypeValidator* const baseValidator @@ -157,8 +161,8 @@ StringDatatypeValidator::StringDatatypeValidator( , const int finalSet , MemoryManager* const manager) :AbstractStringValidator(baseValidator, facets, finalSet, DatatypeValidator::String, manager) -,fWhiteSpace(DatatypeValidator::PRESERVE) { + setWhiteSpace(DatatypeValidator::PRESERVE); init(enums); } @@ -183,16 +187,11 @@ StringDatatypeValidator::StringDatatypeValidator( , const ValidatorType type , MemoryManager* const manager) :AbstractStringValidator(baseValidator, facets, finalSet, type, manager) -,fWhiteSpace(DatatypeValidator::PRESERVE) { + setWhiteSpace(DatatypeValidator::PRESERVE); // do not invoke init() here!!! } -short StringDatatypeValidator::getWSFacet() const -{ - return fWhiteSpace; -} - // --------------------------------------------------------------------------- // Utilities // --------------------------------------------------------------------------- diff --git a/src/xercesc/validators/datatype/StringDatatypeValidator.hpp b/src/xercesc/validators/datatype/StringDatatypeValidator.hpp index 9d942445ffb070eb6d53b42803603544d7aab292..975391b76b7187e4c4f90bba189e9ddf43bb67ea 100644 --- a/src/xercesc/validators/datatype/StringDatatypeValidator.hpp +++ b/src/xercesc/validators/datatype/StringDatatypeValidator.hpp @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.6 2003/10/01 01:09:35 knoaman + * Refactoring of some code to improve performance. + * * Revision 1.5 2003/09/29 21:47:35 peiyongz * Implementation of Serialization/Deserialization * @@ -122,16 +125,6 @@ public: //@} - // ----------------------------------------------------------------------- - // Getter methods - // ----------------------------------------------------------------------- - /** @name Getter Functions */ - //@{ - - virtual short getWSFacet() const; - - //@} - /** * Returns an instance of the base datatype validator class * Used by the DatatypeValidatorFactory. @@ -175,27 +168,8 @@ protected: virtual void checkValueSpace(const XMLCh* const content); virtual int getLength(const XMLCh* const content) const; - -private: - - inline void setWhiteSpace(short); - - // ----------------------------------------------------------------------- - // Private data members - // - // ----------------------------------------------------------------------- - short fWhiteSpace; //DatatypeValidator::PRESERVE - }; -// ----------------------------------------------------------------------- -// Getter methods -// ----------------------------------------------------------------------- -inline void StringDatatypeValidator::setWhiteSpace(short newValue) -{ - fWhiteSpace = newValue; -} - XERCES_CPP_NAMESPACE_END #endif diff --git a/src/xercesc/validators/schema/SchemaValidator.cpp b/src/xercesc/validators/schema/SchemaValidator.cpp index ab6c66064e870e5794d2a44454c14181c91fc11a..2dba7697614ff5626a0b2f9dbfae27193cc83709 100644 --- a/src/xercesc/validators/schema/SchemaValidator.cpp +++ b/src/xercesc/validators/schema/SchemaValidator.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.37 2003/10/01 01:09:35 knoaman + * Refactoring of some code to improve performance. + * * Revision 1.36 2003/08/14 03:01:04 knoaman * Code refactoring to improve performance of validation. * @@ -626,7 +629,6 @@ void SchemaValidator::validateAttrValue (const XMLAttDef* attDef // XMLAttDef::AttTypes type = attDef->getType(); const XMLAttDef::DefAttTypes defType = attDef->getDefaultType(); - const XMLCh* const fullName = attDef->getFullName(); bool valid = true; // @@ -641,7 +643,7 @@ void SchemaValidator::validateAttrValue (const XMLAttDef* attDef { const XMLCh* const valueText = attDef->getValue(); if (!XMLString::equals(attrValue, valueText)) { - emitError(XMLValid::NotSameAsFixedValue, fullName, attrValue, valueText); + emitError(XMLValid::NotSameAsFixedValue, attDef->getFullName(), attrValue, valueText); valid = false; } } @@ -649,7 +651,7 @@ void SchemaValidator::validateAttrValue (const XMLAttDef* attDef // An empty string cannot be valid for non_CDATA any of the other types if (!attrValue[0] && type != XMLAttDef::Simple) { - emitError(XMLValid::InvalidEmptyAttValue, fullName); + emitError(XMLValid::InvalidEmptyAttValue, attDef->getFullName()); ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::INVALID); ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::INVALID); return; @@ -657,7 +659,7 @@ void SchemaValidator::validateAttrValue (const XMLAttDef* attDef DatatypeValidator* attDefDV = ((SchemaAttDef*) attDef)->getDatatypeValidator(); if (!attDefDV) { - emitError(XMLValid::NoDatatypeValidatorForAttribute, fullName); + emitError(XMLValid::NoDatatypeValidatorForAttribute, attDef->getFullName()); valid = false; } else { @@ -1209,16 +1211,14 @@ void SchemaValidator::postParseValidation() // void SchemaValidator::normalizeWhiteSpace(DatatypeValidator* dV, const XMLCh* const value, XMLBuffer& toFill) { + short wsFacet = dV->getWSFacet(); + toFill.reset(); //empty string if (!*value) return; - short fWhiteSpace = DatatypeValidator::PRESERVE; - if (dV) - fWhiteSpace = dV->getWSFacet(); - enum States { InWhitespace @@ -1227,27 +1227,20 @@ void SchemaValidator::normalizeWhiteSpace(DatatypeValidator* dV, const XMLCh* co States curState = InContent; - // - // Loop through the chars of the source value and normalize it according - // to the whitespace facet - // + // Loop through the chars of the source value and normalize it + // according to the whitespace facet bool firstNonWS = false; XMLCh nextCh; const XMLCh* srcPtr = value; XMLReader* fCurReader = getReaderMgr()->getCurrentReader(); - if ((fWhiteSpace==DatatypeValidator::COLLAPSE) && fTrailing) + if ((wsFacet==DatatypeValidator::COLLAPSE) && fTrailing) toFill.append(chSpace); while (*srcPtr) { nextCh = *srcPtr; - - if (fWhiteSpace == DatatypeValidator::PRESERVE) - { - // do nothing - } - else if (fWhiteSpace == DatatypeValidator::REPLACE) + if (wsFacet == DatatypeValidator::REPLACE) { if (fCurReader->isWhitespace(nextCh)) nextCh = chSpace; @@ -1263,13 +1256,13 @@ void SchemaValidator::normalizeWhiteSpace(DatatypeValidator* dV, const XMLCh* co curState = InContent; firstNonWS = true; } - else + else { srcPtr++; continue; } } - else if (curState == InContent) + else if (curState == InContent) { if (fCurReader->isWhitespace(nextCh)) { @@ -1286,8 +1279,7 @@ void SchemaValidator::normalizeWhiteSpace(DatatypeValidator* dV, const XMLCh* co // And move up to the next character in the source srcPtr++; } - srcPtr--; - if (fCurReader->isWhitespace(*srcPtr)) + if (fCurReader->isWhitespace(*(srcPtr-1))) fTrailing = true; }