You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by jb...@apache.org on 2005/06/04 16:20:59 UTC
svn commit: r179992 - in /xerces/c/branches/xerces-2.7: ./ doc/
src/xercesc/internal/ src/xercesc/util/ src/xercesc/util/regx/
src/xercesc/validators/datatype/
Author: jberry
Date: Sat Jun 4 07:20:58 2005
New Revision: 179992
URL: http://svn.apache.org/viewcvs?rev=179992&view=rev
Log:
Merge changes 178413:179991 to xerces-2.7 branch from main trunk.
I used the command:
svn merge -r 178413:179991 https://svn.apache.org/repos/asf/xerces/c/trunk
This takes changes between revisions 178413 and 179991 of the main trunk, and applies them to
the working directory (in this case, the 2.7 branch).
Modified:
xerces/c/branches/xerces-2.7/credits.txt
xerces/c/branches/xerces-2.7/doc/program-others.xml
xerces/c/branches/xerces-2.7/src/xercesc/internal/DGXMLScanner.cpp
xerces/c/branches/xerces-2.7/src/xercesc/internal/IGXMLScanner.cpp
xerces/c/branches/xerces-2.7/src/xercesc/util/XMLChar.cpp
xerces/c/branches/xerces-2.7/src/xercesc/util/XMLInitializer.cpp
xerces/c/branches/xerces-2.7/src/xercesc/util/XMLInitializer.hpp
xerces/c/branches/xerces-2.7/src/xercesc/util/regx/RegularExpression.cpp
xerces/c/branches/xerces-2.7/src/xercesc/util/regx/RegularExpression.hpp
xerces/c/branches/xerces-2.7/src/xercesc/util/regx/TokenFactory.cpp
xerces/c/branches/xerces-2.7/src/xercesc/util/regx/TokenFactory.hpp
xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp
xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp
xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.cpp
xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.hpp
xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/QNameDatatypeValidator.cpp
xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/QNameDatatypeValidator.hpp
Modified: xerces/c/branches/xerces-2.7/credits.txt
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/credits.txt?rev=179992&r1=179991&r2=179992&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/credits.txt (original)
+++ xerces/c/branches/xerces-2.7/credits.txt Sat Jun 4 07:20:58 2005
@@ -2,7 +2,6 @@
development and ports of the XML4C source code, which was submitted to
the Apache Software Foundation.
-
Nadav Aharoni
Curt Arnold
Edward Avis
Modified: xerces/c/branches/xerces-2.7/doc/program-others.xml
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/doc/program-others.xml?rev=179992&r1=179991&r2=179992&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/doc/program-others.xml (original)
+++ xerces/c/branches/xerces-2.7/doc/program-others.xml Sat Jun 4 07:20:58 2005
@@ -35,7 +35,7 @@
<p>The minor and revision (patch level) numbers have two digits of resolution
which means that '3' becomes '03' and '4' becomes '04' in this example.
</p>
- <p>There are also other string macro, or constants to represent the Xerces-C++ version.
+ <p>There are also other string macros or constants to represent the Xerces-C++ version.
Please refer to the header xercesc/util/XercesVersion.hpp for further details.
</p>
</s2>
Modified: xerces/c/branches/xerces-2.7/src/xercesc/internal/DGXMLScanner.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/internal/DGXMLScanner.cpp?rev=179992&r1=179991&r2=179992&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/internal/DGXMLScanner.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/internal/DGXMLScanner.cpp Sat Jun 4 07:20:58 2005
@@ -809,12 +809,15 @@
//
// Only do this if we are not reusing the validator! If we are reusing,
// then look it up instead. It has to exist!
- DTDElementDecl* rootDecl = new (fGrammarPoolMemoryManager) DTDElementDecl
+ MemoryManager* const rootDeclMgr =
+ fUseCachedGrammar ? fMemoryManager : fGrammarPoolMemoryManager;
+
+ DTDElementDecl* rootDecl = new (rootDeclMgr) DTDElementDecl
(
bbRootName.getRawBuffer()
, fEmptyNamespaceId
, DTDElementDecl::Any
- , fGrammarPoolMemoryManager
+ , rootDeclMgr
);
Janitor<DTDElementDecl> rootDeclJanitor(rootDecl);
@@ -1001,27 +1004,6 @@
fDocTypeHandler->startExtSubset();
fDocTypeHandler->endExtSubset();
}
- // we *cannot* identify the root element on
- // cached grammars; else we risk breaking multithreaded
- // applications. - NG
- /*******
- rootDecl = (DTDElementDecl*) fGrammar->getElemDecl(fEmptyNamespaceId, 0, bbRootName.getRawBuffer(), Grammar::TOP_LEVEL_SCOPE);
-
- if (rootDecl)
- ((DTDGrammar*)fGrammar)->setRootElemId(rootDecl->getId());
- else {
- rootDecl = new (fGrammarPoolMemoryManager) DTDElementDecl
- (
- bbRootName.getRawBuffer()
- , fEmptyNamespaceId
- , DTDElementDecl::Any
- , fGrammarPoolMemoryManager
- );
- rootDecl->setCreateReason(DTDElementDecl::AsRootElem);
- rootDecl->setExternalElemDeclaration(true);
- ((DTDGrammar*)fGrammar)->setRootElemId(fGrammar->putElemDecl(rootDecl));
- }
- *********/
return;
}
@@ -1078,7 +1060,7 @@
// with an external entity. Put a janitor on it to insure it gets
// cleaned up. The reader manager does not adopt them.
const XMLCh gDTDStr[] = { chLatin_D, chLatin_T, chLatin_D , chNull };
- DTDEntityDecl* declDTD = new (fGrammarPoolMemoryManager) DTDEntityDecl(gDTDStr, false, fGrammarPoolMemoryManager);
+ DTDEntityDecl* declDTD = new (fMemoryManager) DTDEntityDecl(gDTDStr, false, fMemoryManager);
declDTD->setSystemId(sysId);
Janitor<DTDEntityDecl> janDecl(declDTD);
@@ -1850,7 +1832,7 @@
// with an external entity. Put a janitor on it to insure it gets
// cleaned up. The reader manager does not adopt them.
const XMLCh gDTDStr[] = { chLatin_D, chLatin_T, chLatin_D , chNull };
- DTDEntityDecl* declDTD = new (fGrammarPoolMemoryManager) DTDEntityDecl(gDTDStr, false, fGrammarPoolMemoryManager);
+ DTDEntityDecl* declDTD = new (fMemoryManager) DTDEntityDecl(gDTDStr, false, fMemoryManager);
declDTD->setSystemId(src.getSystemId());
Janitor<DTDEntityDecl> janDecl(declDTD);
Modified: xerces/c/branches/xerces-2.7/src/xercesc/internal/IGXMLScanner.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/internal/IGXMLScanner.cpp?rev=179992&r1=179991&r2=179992&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/internal/IGXMLScanner.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/internal/IGXMLScanner.cpp Sat Jun 4 07:20:58 2005
@@ -1273,12 +1273,15 @@
//
// Only do this if we are not reusing the validator! If we are reusing,
// then look it up instead. It has to exist!
- DTDElementDecl* rootDecl = new (fGrammarPoolMemoryManager) DTDElementDecl
+ MemoryManager* const rootDeclMgr =
+ fUseCachedGrammar ? fMemoryManager : fGrammarPoolMemoryManager;
+
+ DTDElementDecl* rootDecl = new (rootDeclMgr) DTDElementDecl
(
bbRootName.getRawBuffer()
, fEmptyNamespaceId
, DTDElementDecl::Any
- , fGrammarPoolMemoryManager
+ , rootDeclMgr
);
Janitor<DTDElementDecl> rootDeclJanitor(rootDecl);
@@ -1465,25 +1468,6 @@
fDocTypeHandler->startExtSubset();
fDocTypeHandler->endExtSubset();
}
- // should not be modifying cached grammars!
- /********
- rootDecl = (DTDElementDecl*) fGrammar->getElemDecl(fEmptyNamespaceId, 0, bbRootName.getRawBuffer(), Grammar::TOP_LEVEL_SCOPE);
-
- if (rootDecl)
- ((DTDGrammar*)fGrammar)->setRootElemId(rootDecl->getId());
- else {
- rootDecl = new (fGrammarPoolMemoryManager) DTDElementDecl
- (
- bbRootName.getRawBuffer()
- , fEmptyNamespaceId
- , DTDElementDecl::Any
- , fGrammarPoolMemoryManager
- );
- rootDecl->setCreateReason(DTDElementDecl::AsRootElem);
- rootDecl->setExternalElemDeclaration(true);
- ((DTDGrammar*)fGrammar)->setRootElemId(fGrammar->putElemDecl(rootDecl));
- }
- ********/
return;
}
@@ -1540,7 +1524,7 @@
// with an external entity. Put a janitor on it to insure it gets
// cleaned up. The reader manager does not adopt them.
const XMLCh gDTDStr[] = { chLatin_D, chLatin_T, chLatin_D , chNull };
- DTDEntityDecl* declDTD = new (fGrammarPoolMemoryManager) DTDEntityDecl(gDTDStr, false, fGrammarPoolMemoryManager);
+ DTDEntityDecl* declDTD = new (fMemoryManager) DTDEntityDecl(gDTDStr, false, fMemoryManager);
declDTD->setSystemId(sysId);
Janitor<DTDEntityDecl> janDecl(declDTD);
@@ -3141,7 +3125,7 @@
// with an external entity. Put a janitor on it to insure it gets
// cleaned up. The reader manager does not adopt them.
const XMLCh gDTDStr[] = { chLatin_D, chLatin_T, chLatin_D , chNull };
- DTDEntityDecl* declDTD = new (fGrammarPoolMemoryManager) DTDEntityDecl(gDTDStr, false, fGrammarPoolMemoryManager);
+ DTDEntityDecl* declDTD = new (fMemoryManager) DTDEntityDecl(gDTDStr, false, fMemoryManager);
declDTD->setSystemId(src.getSystemId());
Janitor<DTDEntityDecl> janDecl(declDTD);
Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/XMLChar.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/XMLChar.cpp?rev=179992&r1=179991&r2=179992&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/XMLChar.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/XMLChar.cpp Sat Jun 4 07:20:58 2005
@@ -4616,7 +4616,7 @@
, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x48, 0x48, 0x40, 0x48, 0x4F
, 0x48, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F
, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x48, 0x48, 0x48, 0x48, 0x20
- , 0x20, 0x20, 0x20, 0x20, 0x20, 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
+ , 0x20, 0x20, 0x20, 0x20, 0x20, 0xF0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48
, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x4D, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48
@@ -5122,7 +5122,7 @@
, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F
, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x4F, 0x4F, 0x48, 0x48
, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48
- , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0xD8, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48
+ , 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0xD0, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48
, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x4D
, 0x4D, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48
, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48
@@ -8924,6 +8924,8 @@
gTmpCharTable[chOpenAngle] &= ~gPlainContentCharMask;
gTmpCharTable[chAmpersand] &= ~gPlainContentCharMask;
gTmpCharTable[chCloseSquare] &= ~gPlainContentCharMask;
+ gTmpCharTable[chLineSeparator] &= ~gPlainContentCharMask;
+ gTmpCharTable[chNEL] &= ~gPlainContentCharMask;
//
Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/XMLInitializer.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/XMLInitializer.cpp?rev=179992&r1=179991&r2=179992&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/XMLInitializer.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/XMLInitializer.cpp Sat Jun 4 07:20:58 2005
@@ -51,6 +51,7 @@
initializeXSDErrReporterMsgLoader();
initializeDTDGrammarDfltEntities();
initializeRangeTokenMap();
+ initializeRegularExpression();
initializeAnyType();
}
catch(...) {
Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/XMLInitializer.hpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/XMLInitializer.hpp?rev=179992&r1=179991&r2=179992&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/XMLInitializer.hpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/XMLInitializer.hpp Sat Jun 4 07:20:58 2005
@@ -76,6 +76,7 @@
static void initializeXSDErrReporterMsgLoader();
static void initializeDTDGrammarDfltEntities();
static void initializeRangeTokenMap();
+ static void initializeRegularExpression();
static void initializeAnyType();
//@}
Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/regx/RegularExpression.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/regx/RegularExpression.cpp?rev=179992&r1=179991&r2=179992&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/regx/RegularExpression.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/regx/RegularExpression.cpp Sat Jun 4 07:20:58 2005
@@ -133,6 +133,8 @@
#include <xercesc/util/IllegalArgumentException.hpp>
#include <xercesc/framework/XMLBuffer.hpp>
#include <xercesc/util/OutOfMemoryException.hpp>
+#include <xercesc/util/XMLInitializer.hpp>
+#include <xercesc/util/XMLRegisterCleanup.hpp>
XERCES_CPP_NAMESPACE_BEGIN
@@ -155,6 +157,17 @@
const unsigned short RegularExpression::WT_OTHER = 2;
RangeToken* RegularExpression::fWordRange = 0;
+
+static void
+localCleanup()
+{
+ RegularExpression::staticCleanup();
+}
+
+static XMLRegisterCleanup WordRangeCleanup;
+
+
+
// ---------------------------------------------------------------------------
// RegularExpression::Context: Constructors and Destructor
// ---------------------------------------------------------------------------
@@ -421,6 +434,8 @@
fTokenTree = regxParser->parse(fPattern, fOptions);
fNoGroups = regxParser->getNoParen();
fHasBackReferences = regxParser->hasBackReferences();
+
+ prepare();
}
// ---------------------------------------------------------------------------
@@ -488,9 +503,6 @@
const int end, Match* const pMatch
, MemoryManager* const manager) {
- if (fOperations == 0)
- prepare();
-
Context context(manager);
int strLength = XMLString::stringLen(expression);
@@ -694,9 +706,6 @@
const int start, const int end,
RefVectorOf<Match> *subEx){
- if (fOperations == 0)
- prepare();
-
RefArrayVectorOf<XMLCh>* tokenStack = new (fMemoryManager) RefArrayVectorOf<XMLCh>(16, true, fMemoryManager);
Context context(fMemoryManager);
@@ -891,6 +900,31 @@
}
+
+// -----------------------------------------------------------------------
+// Static initialize and cleanup methods
+// -----------------------------------------------------------------------
+void
+XMLInitializer::initializeRegularExpression()
+{
+ RegularExpression::staticInitialize(XMLPlatformUtils::fgMemoryManager);
+}
+
+
+
+void
+RegularExpression::staticInitialize(MemoryManager* memoryManager)
+{
+ fWordRange = TokenFactory::staticGetRange(fgUniIsWord, false);
+
+ if (fWordRange == 0)
+ ThrowXMLwithMemMgr1(RuntimeException, XMLExcepts::Regex_RangeTokenGetError, fgUniIsWord, memoryManager);
+
+ WordRangeCleanup.registerCleanup(localCleanup);
+}
+
+
+
// ---------------------------------------------------------------------------
// RegularExpression: Helpers methods
// ---------------------------------------------------------------------------
@@ -1533,13 +1567,12 @@
}
+
/*
- * Prepares for matching. This method is called just before starting matching
+ * Prepares for matching. This method is called during construction.
*/
void RegularExpression::prepare() {
- XMLMutexLock lockInit(&fMutex);
-
compile(fTokenTree);
fMinLength = fTokenTree->getMinLength();
@@ -1622,7 +1655,7 @@
if (isSet(fOptions, USE_UNICODE_CATEGORY)) {
- if (fWordRange == 0) {
+ if (fWordRange == 0) {
fWordRange = fTokenFactory->getRange(fgUniIsWord);
if (fWordRange == 0)
Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/regx/RegularExpression.hpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/regx/RegularExpression.hpp?rev=179992&r1=179991&r2=179992&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/regx/RegularExpression.hpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/regx/RegularExpression.hpp Sat Jun 4 07:20:58 2005
@@ -27,7 +27,6 @@
#include <xercesc/util/RefArrayVectorOf.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/Janitor.hpp>
-#include <xercesc/util/Mutexes.hpp>
#include <xercesc/util/regx/Op.hpp>
#include <xercesc/util/regx/TokenFactory.hpp>
#include <xercesc/util/regx/BMPattern.hpp>
@@ -139,6 +138,15 @@
XMLCh *replace(const XMLCh* const matchString, const XMLCh* const replaceString,
const int start, const int end);
+ // -----------------------------------------------------------------------
+ // Static initialize and cleanup methods
+ // -----------------------------------------------------------------------
+ static void
+ staticInitialize(MemoryManager* memoryManager);
+
+ static void
+ staticCleanup();
+
private:
// -----------------------------------------------------------------------
// Private data types
@@ -288,11 +296,19 @@
RangeToken* fFirstChar;
static RangeToken* fWordRange;
OpFactory fOpFactory;
- XMLMutex fMutex;
TokenFactory* fTokenFactory;
MemoryManager* fMemoryManager;
};
+
+
+ // -----------------------------------------------------------------------
+ // RegularExpression: Static initialize and cleanup methods
+ // -----------------------------------------------------------------------
+ inline void RegularExpression::staticCleanup()
+ {
+ fWordRange = 0;
+ }
// ---------------------------------------------------------------------------
// RegularExpression: Cleanup methods
Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/regx/TokenFactory.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/regx/TokenFactory.cpp?rev=179992&r1=179991&r2=179992&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/regx/TokenFactory.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/regx/TokenFactory.cpp Sat Jun 4 07:20:58 2005
@@ -258,7 +258,7 @@
// ---------------------------------------------------------------------------
// TokenFactory - Getter methods
// ---------------------------------------------------------------------------
-RangeToken* TokenFactory::getRange(const XMLCh* const keyword,
+RangeToken* TokenFactory::staticGetRange(const XMLCh* const keyword,
const bool complement) {
return RangeTokenMap::instance()->getRange(keyword, complement);
Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/regx/TokenFactory.hpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/util/regx/TokenFactory.hpp?rev=179992&r1=179991&r2=179992&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/regx/TokenFactory.hpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/regx/TokenFactory.hpp Sat Jun 4 07:20:58 2005
@@ -98,6 +98,8 @@
Token* getGraphemePattern();
MemoryManager* getMemoryManager() const;
+ static RangeToken* staticGetRange(const XMLCh* const name,const bool complement=false);
+
// -----------------------------------------------------------------------
// Notification that lazy data has been deleted
// -----------------------------------------------------------------------
@@ -137,6 +139,11 @@
Token* fGrapheme;
MemoryManager* fMemoryManager;
};
+
+inline RangeToken* TokenFactory::getRange(const XMLCh* const name,const bool complement)
+{
+ return staticGetRange(name, complement);
+}
inline MemoryManager* TokenFactory::getMemoryManager() const
{
Modified: xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp?rev=179992&r1=179991&r2=179992&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp Sat Jun 4 07:20:58 2005
@@ -134,7 +134,7 @@
void Base64BinaryDatatypeValidator::checkValueSpace(const XMLCh* const content
, MemoryManager* const manager)
{
- if (getLength(content, manager) <= 0)
+ if (getLength(content, manager) < 0)
{
ThrowXMLwithMemMgr1(InvalidDatatypeValueException
, XMLExcepts::VALUE_Not_Base64
Modified: xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp?rev=179992&r1=179991&r2=179992&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp Sat Jun 4 07:20:58 2005
@@ -128,7 +128,7 @@
void HexBinaryDatatypeValidator::checkValueSpace(const XMLCh* const content
, MemoryManager* const manager)
{
- if (getLength(content, manager) <= 0)
+ if (getLength(content, manager) < 0)
{
ThrowXMLwithMemMgr1(InvalidDatatypeValueException
, XMLExcepts::VALUE_Not_HexBin
Modified: xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.cpp?rev=179992&r1=179991&r2=179992&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.cpp Sat Jun 4 07:20:58 2005
@@ -138,6 +138,74 @@
}
+void NOTATIONDatatypeValidator::checkContent( const XMLCh* const content
+ , ValidationContext* const context
+ , bool asBase
+ , MemoryManager* const manager
+ )
+{
+
+ //validate against base validator if any
+ NOTATIONDatatypeValidator *pBaseValidator = (NOTATIONDatatypeValidator*) this->getBaseValidator();
+ if (pBaseValidator)
+ pBaseValidator->checkContent(content, context, true, manager);
+
+ int thisFacetsDefined = getFacetsDefined();
+
+ // we check pattern first
+ if ( (thisFacetsDefined & DatatypeValidator::FACET_PATTERN ) != 0 )
+ {
+ // lazy construction
+ if (getRegex() ==0) {
+ try {
+ // REVISIT: cargillmem fMemoryManager or manager?
+ setRegex(new (fMemoryManager) RegularExpression(getPattern(), SchemaSymbols::fgRegEx_XOption, fMemoryManager));
+ }
+ catch (XMLException &e)
+ {
+ ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::RethrowError, e.getMessage(), fMemoryManager);
+ }
+ }
+
+ if (getRegex()->matches(content, manager) ==false)
+ {
+ ThrowXMLwithMemMgr2(InvalidDatatypeValueException
+ , XMLExcepts::VALUE_NotMatch_Pattern
+ , content
+ , getPattern()
+ , manager);
+ }
+ }
+
+ // if this is a base validator, we only need to check pattern facet
+ // all other facet were inherited by the derived type
+ if (asBase)
+ return;
+
+ checkValueSpace(content, manager);
+
+ if ((thisFacetsDefined & DatatypeValidator::FACET_ENUMERATION) != 0 &&
+ (getEnumeration() != 0))
+ {
+ XMLCh* normContent = XMLString::replicate(content, manager);
+ ArrayJanitor<XMLCh> jan(normContent, manager);
+ normalizeContent(normContent, manager);
+
+ int i=0;
+ int enumLength = getEnumeration()->size();
+ for ( ; i < enumLength; i++)
+ {
+ if (XMLString::equals(normContent, getEnumeration()->elementAt(i)))
+ break;
+ }
+
+ if (i == enumLength)
+ ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, content, manager);
+ }
+
+ checkAdditionalFacet(content, manager);
+}
+
/***
* Support for Serialization/De-serialization
***/
Modified: xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.hpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.hpp?rev=179992&r1=179991&r2=179992&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.hpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/NOTATIONDatatypeValidator.hpp Sat Jun 4 07:20:58 2005
@@ -116,6 +116,11 @@
virtual void checkValueSpace(const XMLCh* const content
, MemoryManager* const manager);
+ virtual void checkContent(const XMLCh* const content
+ , ValidationContext* const context
+ , bool asBase
+ , MemoryManager* const manager);
+
private:
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
Modified: xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/QNameDatatypeValidator.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/QNameDatatypeValidator.cpp?rev=179992&r1=179991&r2=179992&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/QNameDatatypeValidator.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/QNameDatatypeValidator.cpp Sat Jun 4 07:20:58 2005
@@ -125,6 +125,74 @@
}
}
+void QNameDatatypeValidator::checkContent( const XMLCh* const content
+ , ValidationContext* const context
+ , bool asBase
+ , MemoryManager* const manager
+ )
+{
+
+ //validate against base validator if any
+ QNameDatatypeValidator *pBaseValidator = (QNameDatatypeValidator*) this->getBaseValidator();
+ if (pBaseValidator)
+ pBaseValidator->checkContent(content, context, true, manager);
+
+ int thisFacetsDefined = getFacetsDefined();
+
+ // we check pattern first
+ if ( (thisFacetsDefined & DatatypeValidator::FACET_PATTERN ) != 0 )
+ {
+ // lazy construction
+ if (getRegex() ==0) {
+ try {
+ // REVISIT: cargillmem fMemoryManager or manager?
+ setRegex(new (fMemoryManager) RegularExpression(getPattern(), SchemaSymbols::fgRegEx_XOption, fMemoryManager));
+ }
+ catch (XMLException &e)
+ {
+ ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::RethrowError, e.getMessage(), fMemoryManager);
+ }
+ }
+
+ if (getRegex()->matches(content, manager) ==false)
+ {
+ ThrowXMLwithMemMgr2(InvalidDatatypeValueException
+ , XMLExcepts::VALUE_NotMatch_Pattern
+ , content
+ , getPattern()
+ , manager);
+ }
+ }
+
+ // if this is a base validator, we only need to check pattern facet
+ // all other facet were inherited by the derived type
+ if (asBase)
+ return;
+
+ checkValueSpace(content, manager);
+
+ if ((thisFacetsDefined & DatatypeValidator::FACET_ENUMERATION) != 0 &&
+ (getEnumeration() != 0))
+ {
+ XMLCh* normContent = XMLString::replicate(content, manager);
+ ArrayJanitor<XMLCh> jan(normContent, manager);
+ normalizeContent(normContent, manager);
+
+ int i=0;
+ int enumLength = getEnumeration()->size();
+ for ( ; i < enumLength; i++)
+ {
+ if (XMLString::equals(normContent, getEnumeration()->elementAt(i)))
+ break;
+ }
+
+ if (i == enumLength)
+ ThrowXMLwithMemMgr1(InvalidDatatypeValueException, XMLExcepts::VALUE_NotIn_Enumeration, content, manager);
+ }
+
+ checkAdditionalFacet(content, manager);
+}
+
/***
* Support for Serialization/De-serialization
***/
Modified: xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/QNameDatatypeValidator.hpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/QNameDatatypeValidator.hpp?rev=179992&r1=179991&r2=179992&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/QNameDatatypeValidator.hpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/validators/datatype/QNameDatatypeValidator.hpp Sat Jun 4 07:20:58 2005
@@ -115,6 +115,11 @@
virtual void checkValueSpace(const XMLCh* const content
, MemoryManager* const manager);
+ virtual void checkContent(const XMLCh* const content
+ , ValidationContext* const context
+ , bool asBase
+ , MemoryManager* const manager);
+
private:
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org