antioch-0.4.0
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
tinyxml2::XMLPrinter Class Reference

#include <tinyxml2.h>

Inheritance diagram for tinyxml2::XMLPrinter:
tinyxml2::XMLVisitor

Public Member Functions

 XMLPrinter (FILE *file=0, bool compact=false)
 
 ~XMLPrinter ()
 
void PushHeader (bool writeBOM, bool writeDeclaration)
 
void OpenElement (const char *name)
 
void PushAttribute (const char *name, const char *value)
 If streaming, add an attribute to an open element. More...
 
void PushAttribute (const char *name, int value)
 
void PushAttribute (const char *name, unsigned value)
 
void PushAttribute (const char *name, bool value)
 
void PushAttribute (const char *name, double value)
 
void CloseElement ()
 If streaming, close the Element. More...
 
void PushText (const char *text, bool cdata=false)
 Add a text node. More...
 
void PushText (int value)
 Add a text node from an integer. More...
 
void PushText (unsigned value)
 Add a text node from an unsigned. More...
 
void PushText (bool value)
 Add a text node from a bool. More...
 
void PushText (float value)
 Add a text node from a float. More...
 
void PushText (double value)
 Add a text node from a double. More...
 
void PushComment (const char *comment)
 Add a comment. More...
 
void PushDeclaration (const char *value)
 
void PushUnknown (const char *value)
 
virtual bool VisitEnter (const XMLDocument &)
 Visit a document. More...
 
virtual bool VisitExit (const XMLDocument &)
 Visit a document. More...
 
virtual bool VisitEnter (const XMLElement &element, const XMLAttribute *attribute)
 Visit an element. More...
 
virtual bool VisitExit (const XMLElement &element)
 Visit an element. More...
 
virtual bool Visit (const XMLText &text)
 Visit a text node. More...
 
virtual bool Visit (const XMLComment &comment)
 Visit a comment node. More...
 
virtual bool Visit (const XMLDeclaration &declaration)
 Visit a declaration. More...
 
virtual bool Visit (const XMLUnknown &unknown)
 Visit an unknown node. More...
 
const char * CStr () const
 
int CStrSize () const
 

Private Types

enum  { ENTITY_RANGE = 64, BUF_SIZE = 200 }
 

Private Member Functions

void SealElement ()
 
void PrintSpace (int depth)
 
void PrintString (const char *, bool restrictedEntitySet)
 
void Print (const char *format,...)
 

Private Attributes

bool elementJustOpened
 
bool firstElement
 
FILE * fp
 
int depth
 
int textDepth
 
bool processEntities
 
bool compactMode
 
bool entityFlag [ENTITY_RANGE]
 
bool restrictedEntityFlag [ENTITY_RANGE]
 
DynArray< const char *, 10 > stack
 
DynArray< char, 20 > buffer
 

Detailed Description

Printing functionality. The XMLPrinter gives you more options than the XMLDocument::Print() method.

It can:

  1. Print to memory.
  2. Print to a file you provide.
  3. Print XML without a XMLDocument.

Print to Memory

XMLPrinter printer;
doc->Print( &printer );
SomeFunction( printer.CStr() );

Print to a File

You provide the file pointer.

XMLPrinter printer( fp );
doc.Print( &printer );

Print without a XMLDocument

When loading, an XML parser is very useful. However, sometimes when saving, it just gets in the way. The code is often set up for streaming, and constructing the DOM is just overhead.

The Printer supports the streaming case. The following code prints out a trivially simple XML file without ever creating an XML document.

XMLPrinter printer( fp );
printer.OpenElement( "foo" );
printer.PushAttribute( "foo", "bar" );
printer.CloseElement();

Definition at line 1407 of file tinyxml2.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
ENTITY_RANGE 
BUF_SIZE 

Definition at line 1490 of file tinyxml2.h.

Constructor & Destructor Documentation

XMLPrinter::XMLPrinter ( FILE *  file = 0,
bool  compact = false 
)
inline

Construct the printer. If the FILE* is specified, this will print to the FILE. Else it will print to memory, and the result is available in CStr(). If 'compact' is set to true, then output is created with only required whitespace and newlines.

Definition at line 1801 of file tinyxml2_imp.h.

References buffer, ENTITY_RANGE, entityFlag, std::int, tinyxml2::DynArray< T, INIT >::Push(), restrictedEntityFlag, and TIXMLASSERT.

1801  :
1802  elementJustOpened( false ),
1803  firstElement( true ),
1804  fp( file ),
1805  depth( 0 ),
1806  textDepth( -1 ),
1807  processEntities( true ),
1808  compactMode( compact )
1809 {
1810  for( int i=0; i<ENTITY_RANGE; ++i ) {
1811  entityFlag[i] = false;
1812  restrictedEntityFlag[i] = false;
1813  }
1814  for( int i=0; i<NUM_ENTITIES; ++i ) {
1815  TIXMLASSERT( entities[i].value < ENTITY_RANGE );
1816  if ( entities[i].value < ENTITY_RANGE ) {
1817  entityFlag[ (int)entities[i].value ] = true;
1818  }
1819  }
1820  restrictedEntityFlag[(int)'&'] = true;
1821  restrictedEntityFlag[(int)'<'] = true;
1822  restrictedEntityFlag[(int)'>'] = true; // not required, but consistency is nice
1823  buffer.Push( 0 );
1824 }
#define TIXMLASSERT(x)
Definition: tinyxml2.h:68
DynArray< char, 20 > buffer
Definition: tinyxml2.h:1498
a int
Definition: eigen_utils.h:67
bool restrictedEntityFlag[ENTITY_RANGE]
Definition: tinyxml2.h:1495
void Push(T t)
Definition: tinyxml2.h:189
bool entityFlag[ENTITY_RANGE]
Definition: tinyxml2.h:1494
tinyxml2::XMLPrinter::~XMLPrinter ( )
inline

Definition at line 1417 of file tinyxml2.h.

1417 {}

Member Function Documentation

void XMLPrinter::CloseElement ( )
inline

If streaming, close the Element.

Definition at line 1992 of file tinyxml2_imp.h.

References compactMode, depth, elementJustOpened, tinyxml2::DynArray< T, INIT >::Pop(), Print(), PrintSpace(), stack, and textDepth.

Referenced by VisitExit().

1993 {
1994  --depth;
1995  const char* name = stack.Pop();
1996 
1997  if ( elementJustOpened ) {
1998  Print( "/>" );
1999  }
2000  else {
2001  if ( textDepth < 0 && !compactMode) {
2002  Print( "\n" );
2003  PrintSpace( depth );
2004  }
2005  Print( "</%s>", name );
2006  }
2007 
2008  if ( textDepth == depth )
2009  textDepth = -1;
2010  if ( depth == 0 && !compactMode)
2011  Print( "\n" );
2012  elementJustOpened = false;
2013 }
void Print(const char *format,...)
DynArray< const char *, 10 > stack
Definition: tinyxml2.h:1497
void PrintSpace(int depth)
const char* tinyxml2::XMLPrinter::CStr ( ) const
inline

If in print to memory mode, return a pointer to the XML file in memory.

Definition at line 1468 of file tinyxml2.h.

References buffer, and tinyxml2::DynArray< T, INIT >::Mem().

1468 { return buffer.Mem(); }
const T * Mem() const
Definition: tinyxml2.h:216
DynArray< char, 20 > buffer
Definition: tinyxml2.h:1498
int tinyxml2::XMLPrinter::CStrSize ( ) const
inline

If in print to memory mode, return the size of the XML file in memory. (Note the size returned includes the terminating null.)

Definition at line 1474 of file tinyxml2.h.

References buffer, and tinyxml2::DynArray< T, INIT >::Size().

1474 { return buffer.Size(); }
DynArray< char, 20 > buffer
Definition: tinyxml2.h:1498
int Size() const
Definition: tinyxml2.h:214
void XMLPrinter::OpenElement ( const char *  name)
inline

If streaming, start writing an element. The element must be closed with CloseElement()

Definition at line 1926 of file tinyxml2_imp.h.

References compactMode, depth, elementJustOpened, firstElement, Print(), PrintSpace(), tinyxml2::DynArray< T, INIT >::Push(), SealElement(), stack, and textDepth.

Referenced by VisitEnter().

1927 {
1928  if ( elementJustOpened ) {
1929  SealElement();
1930  }
1931  stack.Push( name );
1932 
1933  if ( textDepth < 0 && !firstElement && !compactMode ) {
1934  Print( "\n" );
1935  PrintSpace( depth );
1936  }
1937 
1938  Print( "<%s", name );
1939  elementJustOpened = true;
1940  firstElement = false;
1941  ++depth;
1942 }
void Print(const char *format,...)
void Push(T t)
Definition: tinyxml2.h:189
DynArray< const char *, 10 > stack
Definition: tinyxml2.h:1497
void PrintSpace(int depth)
void XMLPrinter::Print ( const char *  format,
  ... 
)
inlineprivate

Definition at line 1828 of file tinyxml2_imp.h.

References buffer, and tinyxml2::DynArray< T, INIT >::PushArr().

Referenced by CloseElement(), OpenElement(), PrintSpace(), PrintString(), PushAttribute(), PushComment(), PushDeclaration(), PushHeader(), PushText(), PushUnknown(), and SealElement().

1829 {
1830  va_list va;
1831  va_start( va, format );
1832 
1833  if ( fp ) {
1834  vfprintf( fp, format, va );
1835  }
1836  else {
1837  // This seems brutally complex. Haven't figured out a better
1838  // way on windows.
1839  #ifdef _MSC_VER
1840  int len = -1;
1841  int expand = 1000;
1842  while ( len < 0 ) {
1843  len = vsnprintf_s( accumulator.Mem(), accumulator.Capacity(), _TRUNCATE, format, va );
1844  if ( len < 0 ) {
1845  expand *= 3/2;
1846  accumulator.PushArr( expand );
1847  }
1848  }
1849  char* p = buffer.PushArr( len ) - 1;
1850  memcpy( p, accumulator.Mem(), len+1 );
1851  #else
1852  int len = vsnprintf( 0, 0, format, va );
1853  // Close out and re-start the va-args
1854  va_end( va );
1855  va_start( va, format );
1856  char* p = buffer.PushArr( len ) - 1;
1857  vsnprintf( p, len+1, format, va );
1858  #endif
1859  }
1860  va_end( va );
1861 }
DynArray< char, 20 > buffer
Definition: tinyxml2.h:1498
T * PushArr(int count)
Definition: tinyxml2.h:195
void XMLPrinter::PrintSpace ( int  depth)
inlineprivate

Definition at line 1865 of file tinyxml2_imp.h.

References depth, and Print().

Referenced by CloseElement(), OpenElement(), PushComment(), PushDeclaration(), and PushUnknown().

1866 {
1867  for( int i=0; i<depth; ++i ) {
1868  Print( " " );
1869  }
1870 }
void Print(const char *format,...)
void XMLPrinter::PrintString ( const char *  p,
bool  restrictedEntitySet 
)
inlineprivate

Definition at line 1874 of file tinyxml2_imp.h.

References ENTITY_RANGE, entityFlag, Print(), processEntities, and restrictedEntityFlag.

Referenced by PushAttribute(), and PushText().

1875 {
1876  // Look for runs of bytes between entities to print.
1877  const char* q = p;
1878  const bool* flag = restricted ? restrictedEntityFlag : entityFlag;
1879 
1880  if ( processEntities ) {
1881  while ( *q ) {
1882  // Remember, char is sometimes signed. (How many times has that bitten me?)
1883  if ( *q > 0 && *q < ENTITY_RANGE ) {
1884  // Check for entities. If one is found, flush
1885  // the stream up until the entity, write the
1886  // entity, and keep looking.
1887  if ( flag[(unsigned)(*q)] ) {
1888  while ( p < q ) {
1889  Print( "%c", *p );
1890  ++p;
1891  }
1892  for( int i=0; i<NUM_ENTITIES; ++i ) {
1893  if ( entities[i].value == *q ) {
1894  Print( "&%s;", entities[i].pattern );
1895  break;
1896  }
1897  }
1898  ++p;
1899  }
1900  }
1901  ++q;
1902  }
1903  }
1904  // Flush the remaining string. This will be the entire
1905  // string if an entity wasn't found.
1906  if ( !processEntities || (q-p > 0) ) {
1907  Print( "%s", p );
1908  }
1909 }
void Print(const char *format,...)
bool restrictedEntityFlag[ENTITY_RANGE]
Definition: tinyxml2.h:1495
bool entityFlag[ENTITY_RANGE]
Definition: tinyxml2.h:1494
void XMLPrinter::PushAttribute ( const char *  name,
const char *  value 
)
inline

If streaming, add an attribute to an open element.

Definition at line 1946 of file tinyxml2_imp.h.

References elementJustOpened, Print(), PrintString(), and TIXMLASSERT.

Referenced by PushAttribute(), and VisitEnter().

1947 {
1949  Print( " %s=\"", name );
1950  PrintString( value, false );
1951  Print( "\"" );
1952 }
#define TIXMLASSERT(x)
Definition: tinyxml2.h:68
void Print(const char *format,...)
void PrintString(const char *, bool restrictedEntitySet)
void XMLPrinter::PushAttribute ( const char *  name,
int  value 
)
inline

Definition at line 1956 of file tinyxml2_imp.h.

References BUF_SIZE, PushAttribute(), and tinyxml2::XMLUtil::ToStr().

1957 {
1958  char buf[BUF_SIZE];
1959  XMLUtil::ToStr( v, buf, BUF_SIZE );
1960  PushAttribute( name, buf );
1961 }
static void ToStr(int v, char *buffer, int bufferSize)
Definition: tinyxml2_imp.h:415
void PushAttribute(const char *name, const char *value)
If streaming, add an attribute to an open element.
void XMLPrinter::PushAttribute ( const char *  name,
unsigned  value 
)
inline

Definition at line 1965 of file tinyxml2_imp.h.

References BUF_SIZE, PushAttribute(), and tinyxml2::XMLUtil::ToStr().

1966 {
1967  char buf[BUF_SIZE];
1968  XMLUtil::ToStr( v, buf, BUF_SIZE );
1969  PushAttribute( name, buf );
1970 }
static void ToStr(int v, char *buffer, int bufferSize)
Definition: tinyxml2_imp.h:415
void PushAttribute(const char *name, const char *value)
If streaming, add an attribute to an open element.
void XMLPrinter::PushAttribute ( const char *  name,
bool  value 
)
inline

Definition at line 1974 of file tinyxml2_imp.h.

References BUF_SIZE, PushAttribute(), and tinyxml2::XMLUtil::ToStr().

1975 {
1976  char buf[BUF_SIZE];
1977  XMLUtil::ToStr( v, buf, BUF_SIZE );
1978  PushAttribute( name, buf );
1979 }
static void ToStr(int v, char *buffer, int bufferSize)
Definition: tinyxml2_imp.h:415
void PushAttribute(const char *name, const char *value)
If streaming, add an attribute to an open element.
void XMLPrinter::PushAttribute ( const char *  name,
double  value 
)
inline

Definition at line 1983 of file tinyxml2_imp.h.

References BUF_SIZE, PushAttribute(), and tinyxml2::XMLUtil::ToStr().

1984 {
1985  char buf[BUF_SIZE];
1986  XMLUtil::ToStr( v, buf, BUF_SIZE );
1987  PushAttribute( name, buf );
1988 }
static void ToStr(int v, char *buffer, int bufferSize)
Definition: tinyxml2_imp.h:415
void PushAttribute(const char *name, const char *value)
If streaming, add an attribute to an open element.
void XMLPrinter::PushComment ( const char *  comment)
inline

Add a comment.

Definition at line 2089 of file tinyxml2_imp.h.

References compactMode, depth, elementJustOpened, firstElement, Print(), PrintSpace(), SealElement(), and textDepth.

Referenced by Visit().

2090 {
2091  if ( elementJustOpened ) {
2092  SealElement();
2093  }
2094  if ( textDepth < 0 && !firstElement && !compactMode) {
2095  Print( "\n" );
2096  PrintSpace( depth );
2097  }
2098  firstElement = false;
2099  Print( "<!--%s-->", comment );
2100 }
void Print(const char *format,...)
void PrintSpace(int depth)
void XMLPrinter::PushDeclaration ( const char *  value)
inline

Definition at line 2104 of file tinyxml2_imp.h.

References compactMode, depth, elementJustOpened, firstElement, Print(), PrintSpace(), SealElement(), and textDepth.

Referenced by PushHeader(), and Visit().

2105 {
2106  if ( elementJustOpened ) {
2107  SealElement();
2108  }
2109  if ( textDepth < 0 && !firstElement && !compactMode) {
2110  Print( "\n" );
2111  PrintSpace( depth );
2112  }
2113  firstElement = false;
2114  Print( "<?%s?>", value );
2115 }
void Print(const char *format,...)
void PrintSpace(int depth)
void XMLPrinter::PushHeader ( bool  writeBOM,
bool  writeDeclaration 
)
inline

If streaming, write the BOM and declaration.

Definition at line 1913 of file tinyxml2_imp.h.

References Print(), and PushDeclaration().

Referenced by VisitEnter().

1914 {
1915  static const unsigned char bom[] = { TIXML_UTF_LEAD_0, TIXML_UTF_LEAD_1, TIXML_UTF_LEAD_2, 0 };
1916  if ( writeBOM ) {
1917  Print( "%s", bom );
1918  }
1919  if ( writeDec ) {
1920  PushDeclaration( "xml version=\"1.0\"" );
1921  }
1922 }
void Print(const char *format,...)
void PushDeclaration(const char *value)
void XMLPrinter::PushText ( const char *  text,
bool  cdata = false 
)
inline

Add a text node.

Definition at line 2025 of file tinyxml2_imp.h.

References depth, elementJustOpened, Print(), PrintString(), SealElement(), and textDepth.

Referenced by PushText(), and Visit().

2026 {
2027  textDepth = depth-1;
2028 
2029  if ( elementJustOpened ) {
2030  SealElement();
2031  }
2032  if ( cdata ) {
2033  Print( "<![CDATA[" );
2034  Print( "%s", text );
2035  Print( "]]>" );
2036  }
2037  else {
2038  PrintString( text, true );
2039  }
2040 }
void Print(const char *format,...)
void PrintString(const char *, bool restrictedEntitySet)
void XMLPrinter::PushText ( int  value)
inline

Add a text node from an integer.

Definition at line 2044 of file tinyxml2_imp.h.

References BUF_SIZE, PushText(), and tinyxml2::XMLUtil::ToStr().

2045 {
2046  char buf[BUF_SIZE];
2047  XMLUtil::ToStr( value, buf, BUF_SIZE );
2048  PushText( buf, false );
2049 }
static void ToStr(int v, char *buffer, int bufferSize)
Definition: tinyxml2_imp.h:415
void PushText(const char *text, bool cdata=false)
Add a text node.
void XMLPrinter::PushText ( unsigned  value)
inline

Add a text node from an unsigned.

Definition at line 2053 of file tinyxml2_imp.h.

References BUF_SIZE, PushText(), and tinyxml2::XMLUtil::ToStr().

2054 {
2055  char buf[BUF_SIZE];
2056  XMLUtil::ToStr( value, buf, BUF_SIZE );
2057  PushText( buf, false );
2058 }
static void ToStr(int v, char *buffer, int bufferSize)
Definition: tinyxml2_imp.h:415
void PushText(const char *text, bool cdata=false)
Add a text node.
void XMLPrinter::PushText ( bool  value)
inline

Add a text node from a bool.

Definition at line 2062 of file tinyxml2_imp.h.

References BUF_SIZE, PushText(), and tinyxml2::XMLUtil::ToStr().

2063 {
2064  char buf[BUF_SIZE];
2065  XMLUtil::ToStr( value, buf, BUF_SIZE );
2066  PushText( buf, false );
2067 }
static void ToStr(int v, char *buffer, int bufferSize)
Definition: tinyxml2_imp.h:415
void PushText(const char *text, bool cdata=false)
Add a text node.
void XMLPrinter::PushText ( float  value)
inline

Add a text node from a float.

Definition at line 2071 of file tinyxml2_imp.h.

References BUF_SIZE, PushText(), and tinyxml2::XMLUtil::ToStr().

2072 {
2073  char buf[BUF_SIZE];
2074  XMLUtil::ToStr( value, buf, BUF_SIZE );
2075  PushText( buf, false );
2076 }
static void ToStr(int v, char *buffer, int bufferSize)
Definition: tinyxml2_imp.h:415
void PushText(const char *text, bool cdata=false)
Add a text node.
void XMLPrinter::PushText ( double  value)
inline

Add a text node from a double.

Definition at line 2080 of file tinyxml2_imp.h.

References BUF_SIZE, PushText(), and tinyxml2::XMLUtil::ToStr().

2081 {
2082  char buf[BUF_SIZE];
2083  XMLUtil::ToStr( value, buf, BUF_SIZE );
2084  PushText( buf, false );
2085 }
static void ToStr(int v, char *buffer, int bufferSize)
Definition: tinyxml2_imp.h:415
void PushText(const char *text, bool cdata=false)
Add a text node.
void XMLPrinter::PushUnknown ( const char *  value)
inline

Definition at line 2119 of file tinyxml2_imp.h.

References compactMode, depth, elementJustOpened, firstElement, Print(), PrintSpace(), SealElement(), and textDepth.

Referenced by Visit().

2120 {
2121  if ( elementJustOpened ) {
2122  SealElement();
2123  }
2124  if ( textDepth < 0 && !firstElement && !compactMode) {
2125  Print( "\n" );
2126  PrintSpace( depth );
2127  }
2128  firstElement = false;
2129  Print( "<!%s>", value );
2130 }
void Print(const char *format,...)
void PrintSpace(int depth)
void XMLPrinter::SealElement ( )
inlineprivate

Definition at line 2017 of file tinyxml2_imp.h.

References elementJustOpened, and Print().

Referenced by OpenElement(), PushComment(), PushDeclaration(), PushText(), and PushUnknown().

2018 {
2019  elementJustOpened = false;
2020  Print( ">" );
2021 }
void Print(const char *format,...)
bool XMLPrinter::Visit ( const XMLText )
inlinevirtual

Visit a text node.

Reimplemented from tinyxml2::XMLVisitor.

Definition at line 2165 of file tinyxml2_imp.h.

References tinyxml2::XMLText::CData(), PushText(), and tinyxml2::XMLNode::Value().

2166 {
2167  PushText( text.Value(), text.CData() );
2168  return true;
2169 }
void PushText(const char *text, bool cdata=false)
Add a text node.
bool XMLPrinter::Visit ( const XMLComment )
inlinevirtual

Visit a comment node.

Reimplemented from tinyxml2::XMLVisitor.

Definition at line 2173 of file tinyxml2_imp.h.

References PushComment(), and tinyxml2::XMLNode::Value().

2174 {
2175  PushComment( comment.Value() );
2176  return true;
2177 }
void PushComment(const char *comment)
Add a comment.
bool XMLPrinter::Visit ( const XMLDeclaration )
inlinevirtual

Visit a declaration.

Reimplemented from tinyxml2::XMLVisitor.

Definition at line 2180 of file tinyxml2_imp.h.

References PushDeclaration(), and tinyxml2::XMLNode::Value().

2181 {
2182  PushDeclaration( declaration.Value() );
2183  return true;
2184 }
void PushDeclaration(const char *value)
bool XMLPrinter::Visit ( const XMLUnknown )
inlinevirtual

Visit an unknown node.

Reimplemented from tinyxml2::XMLVisitor.

Definition at line 2188 of file tinyxml2_imp.h.

References PushUnknown(), and tinyxml2::XMLNode::Value().

2189 {
2190  PushUnknown( unknown.Value() );
2191  return true;
2192 }
void PushUnknown(const char *value)
bool XMLPrinter::VisitEnter ( const XMLDocument )
inlinevirtual

Visit a document.

Reimplemented from tinyxml2::XMLVisitor.

Definition at line 2134 of file tinyxml2_imp.h.

References tinyxml2::XMLDocument::HasBOM(), tinyxml2::XMLDocument::ProcessEntities(), processEntities, and PushHeader().

2135 {
2136  processEntities = doc.ProcessEntities();
2137  if ( doc.HasBOM() ) {
2138  PushHeader( true, false );
2139  }
2140  return true;
2141 }
void PushHeader(bool writeBOM, bool writeDeclaration)
bool XMLPrinter::VisitEnter ( const XMLElement ,
const XMLAttribute  
)
inlinevirtual

Visit an element.

Reimplemented from tinyxml2::XMLVisitor.

Definition at line 2145 of file tinyxml2_imp.h.

References tinyxml2::XMLAttribute::Name(), tinyxml2::XMLElement::Name(), tinyxml2::XMLAttribute::Next(), OpenElement(), PushAttribute(), and tinyxml2::XMLAttribute::Value().

2146 {
2147  OpenElement( element.Name() );
2148  while ( attribute ) {
2149  PushAttribute( attribute->Name(), attribute->Value() );
2150  attribute = attribute->Next();
2151  }
2152  return true;
2153 }
void PushAttribute(const char *name, const char *value)
If streaming, add an attribute to an open element.
void OpenElement(const char *name)
virtual bool tinyxml2::XMLPrinter::VisitExit ( const XMLDocument )
inlinevirtual

Visit a document.

Reimplemented from tinyxml2::XMLVisitor.

Definition at line 1454 of file tinyxml2.h.

1454 { return true; }
bool XMLPrinter::VisitExit ( const XMLElement )
inlinevirtual

Visit an element.

Reimplemented from tinyxml2::XMLVisitor.

Definition at line 2157 of file tinyxml2_imp.h.

References CloseElement().

2158 {
2159  CloseElement();
2160  return true;
2161 }
void CloseElement()
If streaming, close the Element.

Member Data Documentation

DynArray< char, 20 > tinyxml2::XMLPrinter::buffer
private

Definition at line 1498 of file tinyxml2.h.

Referenced by CStr(), CStrSize(), Print(), and XMLPrinter().

bool tinyxml2::XMLPrinter::compactMode
private

Definition at line 1488 of file tinyxml2.h.

Referenced by CloseElement(), OpenElement(), PushComment(), PushDeclaration(), and PushUnknown().

int tinyxml2::XMLPrinter::depth
private
bool tinyxml2::XMLPrinter::elementJustOpened
private
bool tinyxml2::XMLPrinter::entityFlag[ENTITY_RANGE]
private

Definition at line 1494 of file tinyxml2.h.

Referenced by PrintString(), and XMLPrinter().

bool tinyxml2::XMLPrinter::firstElement
private

Definition at line 1483 of file tinyxml2.h.

Referenced by OpenElement(), PushComment(), PushDeclaration(), and PushUnknown().

FILE* tinyxml2::XMLPrinter::fp
private

Definition at line 1484 of file tinyxml2.h.

bool tinyxml2::XMLPrinter::processEntities
private

Definition at line 1487 of file tinyxml2.h.

Referenced by PrintString(), and VisitEnter().

bool tinyxml2::XMLPrinter::restrictedEntityFlag[ENTITY_RANGE]
private

Definition at line 1495 of file tinyxml2.h.

Referenced by PrintString(), and XMLPrinter().

DynArray< const char*, 10 > tinyxml2::XMLPrinter::stack
private

Definition at line 1497 of file tinyxml2.h.

Referenced by CloseElement(), and OpenElement().

int tinyxml2::XMLPrinter::textDepth
private

The documentation for this class was generated from the following files:

Generated on Thu Jul 7 2016 11:09:53 for antioch-0.4.0 by  doxygen 1.8.8