You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by le...@locus.apache.org on 2000/04/29 01:21:23 UTC
cvs commit: xml-xerces/c/src/dom AttrImpl.cpp
lehors 00/04/28 16:21:23
Modified: c/src/dom AttrImpl.cpp
Log:
most attributes only have their value stored into a single Text
node, so getValue() is now optimised to avoid building a StringBuffer in
this simple and very common case
Revision Changes Path
1.16 +8 -2 xml-xerces/c/src/dom/AttrImpl.cpp
Index: AttrImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/dom/AttrImpl.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- AttrImpl.cpp 2000/04/27 02:52:42 1.15
+++ AttrImpl.cpp 2000/04/28 23:21:22 1.16
@@ -55,7 +55,7 @@
*/
/*
- * $Id: AttrImpl.cpp,v 1.15 2000/04/27 02:52:42 lehors Exp $
+ * $Id: AttrImpl.cpp,v 1.16 2000/04/28 23:21:22 lehors Exp $
*/
#include "AttrImpl.hpp"
@@ -125,8 +125,14 @@
DOMString AttrImpl::getValue()
{
+ if (firstChild == null) {
+ return 0; // return "";
+ }
+ ChildNode *node = firstChild->nextSibling;
+ if (node == null) {
+ return firstChild->getNodeValue().clone();
+ }
int length = 0;
- ChildNode *node;
for (node = firstChild; node != null; node = node->nextSibling)
length += node->getNodeValue().length();