Fixed bug causing duplication of text content.
authorScott Cantor <cantor.2@osu.edu>
Wed, 17 Oct 2007 04:10:02 +0000 (04:10 +0000)
committerScott Cantor <cantor.2@osu.edu>
Wed, 17 Oct 2007 04:10:02 +0000 (04:10 +0000)
xmltooling/io/AbstractXMLObjectMarshaller.cpp
xmltoolingtest/data/SimpleXMLObjectWithContent.xml

index 500f431..0c87aff 100644 (file)
@@ -316,23 +316,22 @@ void AbstractXMLObjectMarshaller::marshallContent(
 {
     m_log.debug("marshalling text and child elements for XMLObject");
     
-    const XMLCh* val;
     unsigned int pos=0;
+    const XMLCh* val = getTextContent(pos);
+    if (val && *val)
+        domElement->appendChild(domElement->getOwnerDocument()->createTextNode(val));
+    
     const list<XMLObject*>& children=getOrderedChildren();
     for (list<XMLObject*>::const_iterator i=children.begin(); i!=children.end(); ++i) {
-        val = getTextContent(pos);
-        if (val && *val)
-            domElement->appendChild(domElement->getOwnerDocument()->createTextNode(val));
         if (*i) {
 #ifndef XMLTOOLING_NO_XMLSEC
             (*i)->marshall(domElement,NULL,credential);
 #else
             (*i)->marshall(domElement);
 #endif
-            ++pos;
+            val = getTextContent(++pos);
+            if (val && *val)
+                domElement->appendChild(domElement->getOwnerDocument()->createTextNode(val));
         }
     }
-    val = getTextContent(pos);
-    if (val && *val)
-        domElement->appendChild(domElement->getOwnerDocument()->createTextNode(val));
 }
index d6df345..3bf4dcf 100644 (file)
Binary files a/xmltoolingtest/data/SimpleXMLObjectWithContent.xml and b/xmltoolingtest/data/SimpleXMLObjectWithContent.xml differ