From: cantor Date: Wed, 17 Oct 2007 04:10:02 +0000 (+0000) Subject: Fixed bug causing duplication of text content. X-Git-Tag: 1.4.1~427 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fxmltooling.git;a=commitdiff_plain;h=5769d12d5618d9a8bd084915febc6388e84cec26 Fixed bug causing duplication of text content. git-svn-id: https://svn.middleware.georgetown.edu/cpp-xmltooling/trunk@399 de75baf8-a10c-0410-a50a-987c0e22f00f --- diff --git a/xmltooling/io/AbstractXMLObjectMarshaller.cpp b/xmltooling/io/AbstractXMLObjectMarshaller.cpp index 500f431..0c87aff 100644 --- a/xmltooling/io/AbstractXMLObjectMarshaller.cpp +++ b/xmltooling/io/AbstractXMLObjectMarshaller.cpp @@ -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& children=getOrderedChildren(); for (list::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)); } diff --git a/xmltoolingtest/data/SimpleXMLObjectWithContent.xml b/xmltoolingtest/data/SimpleXMLObjectWithContent.xml index d6df345..3bf4dcf 100644 Binary files a/xmltoolingtest/data/SimpleXMLObjectWithContent.xml and b/xmltoolingtest/data/SimpleXMLObjectWithContent.xml differ