Added method DynArray::PeekTop(), provides useful abstraction in tinyxml2::XMLPrinterHTML5::CloseElement().  Made tinyxml2::CloseElement() and destructor virtual.  Made tinyxml2::_SealElement(), _elementJustOpened and _stack all protected instead of private (needed in XMLPrinterHTML5 to selective prevent some elements from being self-closing).
diff --git a/tinyxml2.h b/tinyxml2.h
index adda85a..6b29324 100755
--- a/tinyxml2.h
+++ b/tinyxml2.h
@@ -251,6 +251,11 @@
         return _mem[i];

     }

 

+    const T& PeekTop() const                            {

+        TIXMLASSERT( _size > 0 );

+        return _mem[ _size - 1];

+    }

+

     int Size() const					{

         return _size;

     }

@@ -1884,7 +1889,7 @@
     	with only required whitespace and newlines.

     */

     XMLPrinter( FILE* file=0, bool compact = false, int depth = 0 );

-    ~XMLPrinter()	{}

+    virtual ~XMLPrinter()	{}

 

     /** If streaming, write the BOM and declaration. */

     void PushHeader( bool writeBOM, bool writeDeclaration );

@@ -1899,7 +1904,7 @@
     void PushAttribute( const char* name, bool value );

     void PushAttribute( const char* name, double value );

     /// If streaming, close the Element.

-    void CloseElement();

+    virtual void CloseElement();

 

     /// Add a text node.

     void PushText( const char* text, bool cdata=false );

@@ -1949,13 +1954,16 @@
         return _buffer.Size();

     }

 

-private:

+protected:

     void SealElement();

+    bool _elementJustOpened;

+    DynArray< const char*, 10 > _stack;

+

+private:

     void PrintSpace( int depth );

     void PrintString( const char*, bool restrictedEntitySet );	// prints out, after detecting entities.

     void Print( const char* format, ... );

 

-    bool _elementJustOpened;

     bool _firstElement;

     FILE* _fp;

     int _depth;

@@ -1970,7 +1978,6 @@
     bool _entityFlag[ENTITY_RANGE];

     bool _restrictedEntityFlag[ENTITY_RANGE];

 

-    DynArray< const char*, 10 > _stack;

     DynArray< char, 20 > _buffer;

 #ifdef _MSC_VER

     DynArray< char, 20 > _accumulator;