work on the streamer class. A little optimization to the string class. Formatting work.
diff --git a/tinyxml2.cpp b/tinyxml2.cpp
index 69a6289..3bf058e 100644
--- a/tinyxml2.cpp
+++ b/tinyxml2.cpp
@@ -548,14 +548,22 @@
 

 StringStack::StringStack()

 {

-	mem = new char[INIT];

-	*mem = 0;

+	*pool = 0;

+	mem = pool;

 	inUse = 1;	// always has a null

 	allocated = INIT;

 	nPositive = 0;

 }

 

 

+StringStack::~StringStack()

+{

+	if ( mem != pool ) {

+		delete [] mem;

+	}

+}

+

+

 void StringStack::Push( const char* str ) {

 	int needed = strlen( str ) + 1;

 	if ( needed > 1 )

@@ -567,7 +575,9 @@
 

 		char* newMem = new char[more];

 		memcpy( newMem, mem, inUse );

-		delete [] mem;

+		if ( mem != pool ) {

+			delete [] mem;

+		}

 		mem = newMem;

 	}

 	strcpy( mem+inUse, str );

@@ -608,10 +618,12 @@
 	if ( elementJustOpened ) {

 		SealElement();

 	}

+	if ( text.NumPositive() == 0 ) {

+		PrintSpace( depth );

+	}

 	stack.Push( name );

 	text.Push( textParent ? "T" : "" );

 

-	PrintSpace( depth );

 	fprintf( fp, "<%s", name );

 	elementJustOpened = true;

 	++depth;

@@ -629,6 +641,7 @@
 {

 	--depth;

 	const char* name = stack.Pop();

+	int wasPositive = text.NumPositive();

 	text.Pop();

 

 	if ( elementJustOpened ) {

@@ -638,7 +651,9 @@
 		}

 	}

 	else {

-		PrintSpace( depth );

+		if ( wasPositive == 0 ) {

+			PrintSpace( depth );

+		}

 		fprintf( fp, "</%s>", name );

 		if ( text.NumPositive() == 0 ) {

 			fprintf( fp, "\n" );