From df6f199b4e158d1d6cfb99d45258efa22afee715 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 11 Oct 2006 15:24:42 +0000 Subject: Fixed a wierd bug that caused each element of any part of a copied node tree to be partially cross-linked to the node that was the root of the copy. Also fixed a bug in the xmlfilewriter that should make it both faster, and not mess up % style replacements. --- src/test/xmlwritetest/xmlwritetest.cpp | 16 ++++++++-------- src/xmlfilewriter.cpp | 2 +- src/xmlnode.cpp | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/test/xmlwritetest/xmlwritetest.cpp b/src/test/xmlwritetest/xmlwritetest.cpp index fc93510..54c7a80 100644 --- a/src/test/xmlwritetest/xmlwritetest.cpp +++ b/src/test/xmlwritetest/xmlwritetest.cpp @@ -30,19 +30,19 @@ int main() { printf("Testing XmlWriter...\n"); - XmlStringReader *xsr = new XmlStringReader(""); + //XmlStringReader *xsr = new XmlStringReader(""); - printf("%08X\n%08X\n%08X\n", xsr, (XmlReader *)xsr, (XmlDocument *)xsr ); + //printf("%08X\n%08X\n%08X\n", xsr, (XmlReader *)xsr, (XmlDocument *)xsr ); - delete (XmlDocument *)xsr; - //XmlFileWriter wf("test.xml", "\t"); + //delete (XmlDocument *)xsr; + XmlFileWriter wf("test.xml", "\t"); - //fillItIn( wf ); + fillItIn( wf ); - //XmlStringWriter ws("\t"); - //fillItIn( ws ); + XmlStringWriter ws("\t"); + fillItIn( ws ); - //printf("Now the string version:\n\n%s\n", ws.getString().c_str() ); + printf("Now the string version:\n\n%s\n", ws.getString().c_str() ); return 0; } diff --git a/src/xmlfilewriter.cpp b/src/xmlfilewriter.cpp index 19120a0..3c6fb41 100644 --- a/src/xmlfilewriter.cpp +++ b/src/xmlfilewriter.cpp @@ -23,6 +23,6 @@ XmlFileWriter::~XmlFileWriter() void XmlFileWriter::writeString( const char *sString ) { - fprintf( fh, sString ); + fputs( sString, fh ); } diff --git a/src/xmlnode.cpp b/src/xmlnode.cpp index e5c77e2..8468047 100644 --- a/src/xmlnode.cpp +++ b/src/xmlnode.cpp @@ -368,8 +368,8 @@ XmlNode *XmlNode::getCopy() { XmlNode *pChild = ((XmlNode *)lChildren[j])->getCopy(); pNew->lChildren.setAt( j, pChild ); - pChild->pParent = this; - hChildren.insert( pChild->getName(), pChild ); + pChild->pParent = pNew; + pNew->hChildren.insert( pChild->getName(), pChild ); } nSize = lPropNames.getSize(); -- cgit v1.2.3