Use StringList (instead of hashmap) for namespace URIs. Not part of build yet. a=leaf.

This commit is contained in:
Peter.VanderBeken%pandora.be 2000-06-22 07:30:07 +00:00
parent 60b56b018a
commit 294dc77b0e
2 changed files with 16 additions and 12 deletions

View File

@ -25,13 +25,13 @@
* -- added code in ::resolveFunctionCall to support the
* document() function.
*
* $Id: ProcessorState.cpp,v 1.4 2000/06/11 15:59:53 Peter.VanderBeken%pandora.be Exp $
* $Id: ProcessorState.cpp,v 1.5 2000/06/22 07:30:03 Peter.VanderBeken%pandora.be Exp $
*/
/**
* Implementation of ProcessorState
* Much of this code was ported from XSL:P
* @version $Revision: 1.4 $ $Date: 2000/06/11 15:59:53 $
* @version $Revision: 1.5 $ $Date: 2000/06/22 07:30:03 $
**/
#include "ProcessorState.h"
@ -484,16 +484,20 @@ void ProcessorState::preserveSpace(String& names) {
* Sets a new default Namespace URI.
**/
void ProcessorState::setDefaultNameSpaceURI(const String& nsURI) {
Int32 len = nsURI.length();
unsigned long hashCode = 0;
for (Int32 i = 0; i < len; i++) {
hashCode += ((Int32)nsURI.charAt(i)) << 3;
}
String* nsTempURIPointer = 0;
String* nsURIPointer = 0;
StringListIterator theIterator(&nameSpaceURIList);
String* nsURIPointer = (String*)nameSpaceURITable.retrieve(hashCode);
while (theIterator.hasNext()) {
nsTempURIPointer = theIterator.next();
if (nsTempURIPointer->isEqual(nsURI)) {
nsURIPointer = nsTempURIPointer;
break;
}
}
if ( ! nsURIPointer ) {
nsURIPointer = new String(nsURI);
nameSpaceURITable.add(nsURIPointer, hashCode);
nameSpaceURIList.add(nsURIPointer);
}
defaultNameSpaceURIStack.push(nsURIPointer);
} //-- setDefaultNameSpaceURI

View File

@ -21,7 +21,7 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: ProcessorState.h,v 1.3 2000/06/11 16:00:01 Peter.VanderBeken%pandora.be Exp $
* $Id: ProcessorState.h,v 1.4 2000/06/22 07:30:07 Peter.VanderBeken%pandora.be Exp $
*/
@ -50,7 +50,7 @@
/**
* Class used for keeping the current state of the XSL Processor
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
* @version $Revision: 1.3 $ $Date: 2000/06/11 16:00:01 $
* @version $Revision: 1.4 $ $Date: 2000/06/22 07:30:07 $
**/
class ProcessorState : public ContextState
{
@ -360,7 +360,7 @@ private:
ExprParser exprParser;
String xsltNameSpace;
NamedMap nameSpaceMap;
HashTable nameSpaceURITable;
StringList nameSpaceURIList;
Stack defaultNameSpaceURIStack;
//-- default templates