[prev in list] [next in list] [prev in thread] [next in thread]
List: xerces-cvs
Subject: svn commit: r359286 - in /xerces/c/trunk/src/xercesc/validators/schema:
From: amassari () apache ! org
Date: 2005-12-27 21:36:15
Message-ID: 20051227213616.13253.qmail () minotaur ! apache ! org
[Download RAW message or body]
Author: amassari
Date: Tue Dec 27 13:36:11 2005
New Revision: 359286
URL: http://svn.apache.org/viewcvs?rev=359286&view=rev
Log:
Improve validation performances when dealing with schemas with lots of top level \
definitions (jira#1542)
Modified:
xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.cpp
xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.hpp
Modified: xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.cpp?rev=359286&r1=359285&r2=359286&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.cpp Tue Dec 27 13:36:11 \
2005 @@ -66,7 +66,10 @@
{
fImportingInfoList = new (fMemoryManager) RefVectorOf<SchemaInfo>(4, false, \
fMemoryManager); for (unsigned int i = 0; i < C_Count; i++)
+ {
fTopLevelComponents[i] = 0;
+ fLastTopLevelComponent[i] = 0;
+ }
fNonXSAttList = new (fMemoryManager) ValueVectorOf<DOMNode*>(2, fMemoryManager);
fValidationContext = new (fMemoryManager) ValidationContextImpl(fMemoryManager);
}
@@ -100,6 +103,7 @@
delete fTopLevelComponents[i];
fTopLevelComponents[i] = 0;
+ fLastTopLevelComponent[i] = 0;
}
delete fNonXSAttList;
@@ -159,22 +163,19 @@
if (!child)
return 0;
- ValueVectorOf<DOMElement*>* compList = fTopLevelComponents[compCategory];
+ RefHashTableOf<DOMElement>* compList = fTopLevelComponents[compCategory];
if (fTopLevelComponents[compCategory] == 0) {
- compList= new (fMemoryManager) ValueVectorOf<DOMElement*>(16, \
fMemoryManager); + compList= new (fMemoryManager) \
RefHashTableOf<DOMElement>(17, false, fMemoryManager); \
fTopLevelComponents[compCategory] = compList; }
else {
- unsigned int listLen = compList->size();
-
- for (unsigned int i= 0; i < listLen; i++) {
+ DOMElement* cachedChild = compList->get(name);
+ if(cachedChild)
+ return cachedChild;
- child = compList->elementAt(i);
- if (XMLString::equals(child->getAttribute(SchemaSymbols::fgATT_NAME), \
name))
- return child;
- }
+ child = fLastTopLevelComponent[compCategory];
}
DOMElement* redefParent = (DOMElement*) child->getParentNode();
@@ -185,11 +186,13 @@
while (child != 0) {
+ fLastTopLevelComponent[compCategory]=child;
if (XMLString::equals(child->getLocalName(), compName)) {
- compList->addElement(child);
+ const XMLCh* cName=child->getAttribute(SchemaSymbols::fgATT_NAME);
+ compList->put((void*)cName, child);
- if (XMLString::equals(child->getAttribute(SchemaSymbols::fgATT_NAME), \
name)) + if (XMLString::equals(cName, name))
return child;
}
else if (XMLString::equals(child->getLocalName(),SchemaSymbols::fgELT_REDEFINE)
@@ -199,12 +202,14 @@
while (redefineChild != 0) {
+ fLastTopLevelComponent[compCategory]=redefineChild;
if ((!fFailedRedefineList || \
!fFailedRedefineList->containsElement(redefineChild))
&& XMLString::equals(redefineChild->getLocalName(), compName)) {
- compList->addElement(redefineChild);
+ const XMLCh* \
rName=redefineChild->getAttribute(SchemaSymbols::fgATT_NAME); + \
compList->put((void*)rName, redefineChild);
- if \
(XMLString::equals(redefineChild->getAttribute(SchemaSymbols::fgATT_NAME), name)) + \
if (XMLString::equals(rName, name)) return redefineChild;
}
Modified: xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.hpp
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.hpp?rev=359286&r1=359285&r2=359286&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.hpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.hpp Tue Dec 27 13:36:11 \
2005 @@ -40,6 +40,7 @@
#include <xercesc/dom/DOMElement.hpp>
#include <xercesc/util/RefVectorOf.hpp>
#include <xercesc/util/ValueVectorOf.hpp>
+#include <xercesc/util/RefHashTableOf.hpp>
XERCES_CPP_NAMESPACE_BEGIN
@@ -169,7 +170,8 @@
ValueVectorOf<int>* fImportedNSList;
ValueVectorOf<const DOMElement*>* fRecursingAnonTypes;
ValueVectorOf<const XMLCh*>* fRecursingTypeNames;
- ValueVectorOf<DOMElement*>* fTopLevelComponents[C_Count];
+ RefHashTableOf<DOMElement>* fTopLevelComponents[C_Count];
+ DOMElement* fLastTopLevelComponent[C_Count];
ValueVectorOf<DOMNode*>* fNonXSAttList;
ValidationContext* fValidationContext;
MemoryManager* fMemoryManager;
@@ -421,6 +423,7 @@
delete fTopLevelComponents[i];
fTopLevelComponents[i] = 0;
+ fLastTopLevelComponent[i] = 0;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic