You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2005/12/27 22:35:50 UTC
svn commit: r359285 - in
/xerces/c/branches/xerces-2.7/src/xercesc/validators/schema: SchemaInfo.cpp
SchemaInfo.hpp
Author: amassari
Date: Tue Dec 27 13:35:45 2005
New Revision: 359285
URL: http://svn.apache.org/viewcvs?rev=359285&view=rev
Log:
Improve validation performances when dealing with schemas with lots of top level definitions (jira#1542)
Modified:
xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaInfo.cpp
xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaInfo.hpp
Modified: xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaInfo.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaInfo.cpp?rev=359285&r1=359284&r2=359285&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaInfo.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaInfo.cpp Tue Dec 27 13:35:45 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/branches/xerces-2.7/src/xercesc/validators/schema/SchemaInfo.hpp
URL: http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaInfo.hpp?rev=359285&r1=359284&r2=359285&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaInfo.hpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaInfo.hpp Tue Dec 27 13:35:45 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