[sword-cvs] sword/src/utilfuns utilxml.cpp,1.15,1.16

sword@www.crosswire.org sword@www.crosswire.org
Fri, 16 Apr 2004 04:25:00 -0700


Update of /cvs/core/sword/src/utilfuns
In directory www:/tmp/cvs-serv15466/src/utilfuns

Modified Files:
	utilxml.cpp 
Log Message:
Bugfix: Empty tags shouldn't take over the old attribs when the new tag got assigned with = or setText (joachim)

Index: utilxml.cpp
===================================================================
RCS file: /cvs/core/sword/src/utilfuns/utilxml.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- utilxml.cpp	24 Jan 2004 18:47:41 -0000	1.15
+++ utilxml.cpp	16 Apr 2004 11:24:56 -0000	1.16
@@ -31,6 +31,8 @@
 	int start;
 	char *name = 0;
 	char *value = 0;
+	attributes.clear();
+	
 	if (!buf)
 		return;
 	for (i = 0; ((buf[i]) && (!isalpha(buf[i]))); i++);
@@ -134,7 +136,7 @@
 	if (!parsed)
 		parse();
 
-	for (StringPairMap::iterator it = attributes.begin(); it != attributes.end(); it++)
+	for (StringPairMap::const_iterator it = attributes.begin(); it != attributes.end(); it++)
 		retVal.push_back(it->first.c_str());
 
 	return retVal;
@@ -174,7 +176,7 @@
 	if (!parsed)
 		parse();
 
-	StringPairMap::iterator it = attributes.find(attribName);
+	StringPairMap::const_iterator it = attributes.find(attribName);
 	const char *retVal = (it == attributes.end()) ? 0 : it->second.c_str();
 	if ((retVal) && (partNum > -1))
 		retVal = getPart(retVal, partNum, partSplit);