\section{gear\-:\-:Ti\-Xml\-Document Class Reference}
\label{classgear_1_1TiXmlDocument}\index{gear\-::\-Ti\-Xml\-Document@{gear\-::\-Ti\-Xml\-Document}}


Always the top level node.  




{\ttfamily \#include $<$tinyxml.\-h$>$}

Inheritance diagram for gear\-:\-:Ti\-Xml\-Document\-:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3.000000cm]{classgear_1_1TiXmlDocument}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
{\bf Ti\-Xml\-Document} ()\label{classgear_1_1TiXmlDocument_aec14df466a29fac3385bfce9770e4953}

\begin{DoxyCompactList}\small\item\em Create an empty document, that has no name. \end{DoxyCompactList}\item 
{\bf Ti\-Xml\-Document} (const char $\ast$document\-Name)\label{classgear_1_1TiXmlDocument_a422ab8805cf90832c5bc415d521cc9a1}

\begin{DoxyCompactList}\small\item\em Create a document with a name. The name of the document is also the filename of the xml. \end{DoxyCompactList}\item 
{\bf Ti\-Xml\-Document} (const std\-::string \&document\-Name)\label{classgear_1_1TiXmlDocument_aac5de67213f82d581476b9525b787686}

\begin{DoxyCompactList}\small\item\em Constructor. \end{DoxyCompactList}\item 
{\bfseries Ti\-Xml\-Document} (const {\bf Ti\-Xml\-Document} \&copy)\label{classgear_1_1TiXmlDocument_ac8ecb219dde1a83f6367f6e6b8f78cd6}

\item 
void {\bfseries operator=} (const {\bf Ti\-Xml\-Document} \&copy)\label{classgear_1_1TiXmlDocument_ae104de99da28258477607b372610514f}

\item 
bool {\bf Load\-File} (Ti\-Xml\-Encoding encoding=T\-I\-X\-M\-L\-\_\-\-D\-E\-F\-A\-U\-L\-T\-\_\-\-E\-N\-C\-O\-D\-I\-N\-G)
\begin{DoxyCompactList}\small\item\em Load a file using the current document value. \end{DoxyCompactList}\item 
bool {\bf Save\-File} () const \label{classgear_1_1TiXmlDocument_a0d7da698aec7152a7b7491520438878c}

\begin{DoxyCompactList}\small\item\em Save a file using the current document value. Returns true if successful. \end{DoxyCompactList}\item 
bool {\bf Load\-File} (const char $\ast$filename, Ti\-Xml\-Encoding encoding=T\-I\-X\-M\-L\-\_\-\-D\-E\-F\-A\-U\-L\-T\-\_\-\-E\-N\-C\-O\-D\-I\-N\-G)\label{classgear_1_1TiXmlDocument_a239311a5eb2abe82a9e239f22ec5442c}

\begin{DoxyCompactList}\small\item\em Load a file using the given filename. Returns true if successful. \end{DoxyCompactList}\item 
bool {\bf Save\-File} (const char $\ast$filename) const \label{classgear_1_1TiXmlDocument_a72b56075cee69a2aeefaddf6911c2c3c}

\begin{DoxyCompactList}\small\item\em Save a file using the given filename. Returns true if successful. \end{DoxyCompactList}\item 
bool {\bf Load\-File} (const std\-::string \&filename, Ti\-Xml\-Encoding encoding=T\-I\-X\-M\-L\-\_\-\-D\-E\-F\-A\-U\-L\-T\-\_\-\-E\-N\-C\-O\-D\-I\-N\-G)
\item 
bool {\bf Save\-File} (const std\-::string \&filename) const \label{classgear_1_1TiXmlDocument_ae895010e1d977a16c2153293db66277f}

\begin{DoxyCompactList}\small\item\em $<$ S\-T\-L std\-::string version. \end{DoxyCompactList}\item 
virtual const char $\ast$ {\bf Parse} (const char $\ast$p, {\bf Ti\-Xml\-Parsing\-Data} $\ast$data=0, Ti\-Xml\-Encoding encoding=T\-I\-X\-M\-L\-\_\-\-D\-E\-F\-A\-U\-L\-T\-\_\-\-E\-N\-C\-O\-D\-I\-N\-G)
\begin{DoxyCompactList}\small\item\em Parse the given null terminated block of xml data. \end{DoxyCompactList}\item 
const {\bf Ti\-Xml\-Element} $\ast$ {\bf Root\-Element} () const 
\begin{DoxyCompactList}\small\item\em Get the root element -- the only top level element -- of the document. \end{DoxyCompactList}\item 
{\bf Ti\-Xml\-Element} $\ast$ {\bfseries Root\-Element} ()\label{classgear_1_1TiXmlDocument_a45f2fe9bffe55d69fb16a8a1cb3cc9bb}

\item 
bool {\bf Error} () const 
\begin{DoxyCompactList}\small\item\em If an error occurs, Error will be set to true. \end{DoxyCompactList}\item 
const char $\ast$ {\bf Error\-Desc} () const \label{classgear_1_1TiXmlDocument_a437a1bb7a766af3e135b31f0ba5b257c}

\begin{DoxyCompactList}\small\item\em Contains a textual (english) description of the error if one occurs. \end{DoxyCompactList}\item 
int {\bf Error\-Id} () const 
\begin{DoxyCompactList}\small\item\em Generally, you probably want the error string ( \doxyref{Error\-Desc()}{p.}{classgear_1_1TiXmlDocument_a437a1bb7a766af3e135b31f0ba5b257c} ). \end{DoxyCompactList}\item 
int {\bf Error\-Row} ()
\begin{DoxyCompactList}\small\item\em Returns the location (if known) of the error. \end{DoxyCompactList}\item 
int {\bf Error\-Col} ()\label{classgear_1_1TiXmlDocument_a532f304d6170ce702bbcf673b59fbfb6}

\begin{DoxyCompactList}\small\item\em The column where the error occured. See \doxyref{Error\-Row()}{p.}{classgear_1_1TiXmlDocument_a0b9ebdb79d42e87f244bb93979643300} \end{DoxyCompactList}\item 
void {\bf Set\-Tab\-Size} (int \-\_\-tabsize)
\begin{DoxyCompactList}\small\item\em By calling this method, with a tab size greater than 0, the row and column of each node and attribute is stored when the file is loaded. \end{DoxyCompactList}\item 
int {\bfseries Tab\-Size} () const \label{classgear_1_1TiXmlDocument_a96611c12eaf79c5ae2d263c9b9b36866}

\item 
void {\bf Clear\-Error} ()
\begin{DoxyCompactList}\small\item\em If you have handled the error, it can be reset with this call. \end{DoxyCompactList}\item 
void {\bf Print} () const 
\begin{DoxyCompactList}\small\item\em Dump the document to standard out. \end{DoxyCompactList}\item 
virtual void {\bf Print} (F\-I\-L\-E $\ast$cfile, int depth=0) const \label{classgear_1_1TiXmlDocument_abae3b0d569f59dbbbf789d53ec0b62a7}

\begin{DoxyCompactList}\small\item\em Print this Document to a F\-I\-L\-E stream. \end{DoxyCompactList}\item 
void {\bfseries Set\-Error} (int err, const char $\ast$error\-Location, {\bf Ti\-Xml\-Parsing\-Data} $\ast$prev\-Data, Ti\-Xml\-Encoding encoding)\label{classgear_1_1TiXmlDocument_a99945fafbaa190ed59b9735830de7d26}

\end{DoxyCompactItemize}
\subsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
virtual void {\bfseries Stream\-Out} (T\-I\-X\-M\-L\-\_\-\-O\-S\-T\-R\-E\-A\-M $\ast$out) const \label{classgear_1_1TiXmlDocument_a21dbaec1211cbc9265ace526ea43db43}

\item 
virtual {\bf Ti\-Xml\-Node} $\ast$ {\bf Clone} () const 
\begin{DoxyCompactList}\small\item\em Create an exact duplicate of this node and return it. \end{DoxyCompactList}\item 
virtual void {\bfseries Stream\-In} (T\-I\-X\-M\-L\-\_\-\-I\-S\-T\-R\-E\-A\-M $\ast$in, T\-I\-X\-M\-L\-\_\-\-S\-T\-R\-I\-N\-G $\ast$tag)\label{classgear_1_1TiXmlDocument_a0a845413de9dd87ffe813150f4d321f6}

\end{DoxyCompactItemize}
\subsection*{Additional Inherited Members}


\subsection{Detailed Description}
Always the top level node. 

A document binds together all the X\-M\-L pieces. It can be saved, loaded, and printed to the screen. The 'value' of a document node is the xml file name. 

Definition at line 1152 of file tinyxml.\-h.



\subsection{Member Function Documentation}
\index{gear\-::\-Ti\-Xml\-Document@{gear\-::\-Ti\-Xml\-Document}!Clear\-Error@{Clear\-Error}}
\index{Clear\-Error@{Clear\-Error}!gear::TiXmlDocument@{gear\-::\-Ti\-Xml\-Document}}
\subsubsection[{Clear\-Error}]{\setlength{\rightskip}{0pt plus 5cm}void gear\-::\-Ti\-Xml\-Document\-::\-Clear\-Error (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classgear_1_1TiXmlDocument_a71ac7ab18db2b9b9211005c25f582a68}


If you have handled the error, it can be reset with this call. 

The error state is automatically cleared if you Parse a new X\-M\-L block. 

Definition at line 1260 of file tinyxml.\-h.



Referenced by Parse(), and Ti\-Xml\-Document().

\index{gear\-::\-Ti\-Xml\-Document@{gear\-::\-Ti\-Xml\-Document}!Clone@{Clone}}
\index{Clone@{Clone}!gear::TiXmlDocument@{gear\-::\-Ti\-Xml\-Document}}
\subsubsection[{Clone}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Ti\-Xml\-Node} $\ast$ gear\-::\-Ti\-Xml\-Document\-::\-Clone (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [protected]}, {\ttfamily [virtual]}}\label{classgear_1_1TiXmlDocument_ae15db31318a0350cd6bd1568130e65f1}


Create an exact duplicate of this node and return it. 

The memory must be deleted by the caller. 

Implements {\bf gear\-::\-Ti\-Xml\-Node} \doxyref{}{p.}{classgear_1_1TiXmlNode_a8ff0be317d4af0456fdbdb9f92600057}.



Definition at line 1029 of file tinyxml.\-cc.



References Ti\-Xml\-Document().

\index{gear\-::\-Ti\-Xml\-Document@{gear\-::\-Ti\-Xml\-Document}!Error@{Error}}
\index{Error@{Error}!gear::TiXmlDocument@{gear\-::\-Ti\-Xml\-Document}}
\subsubsection[{Error}]{\setlength{\rightskip}{0pt plus 5cm}bool gear\-::\-Ti\-Xml\-Document\-::\-Error (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}\label{classgear_1_1TiXmlDocument_ab3b64b68af6d9596760021fa8930438f}


If an error occurs, Error will be set to true. 

Also,
\begin{DoxyItemize}
\item The \doxyref{Error\-Id()}{p.}{classgear_1_1TiXmlDocument_aa25c1df1e9b900b6b77122728a8964ff} will contain the integer identifier of the error (not generally useful)
\item The \doxyref{Error\-Desc()}{p.}{classgear_1_1TiXmlDocument_a437a1bb7a766af3e135b31f0ba5b257c} method will return the name of the error. (very useful)
\item The \doxyref{Error\-Row()}{p.}{classgear_1_1TiXmlDocument_a0b9ebdb79d42e87f244bb93979643300} and \doxyref{Error\-Col()}{p.}{classgear_1_1TiXmlDocument_a532f304d6170ce702bbcf673b59fbfb6} will return the location of the error (if known) 
\end{DoxyItemize}

Definition at line 1213 of file tinyxml.\-h.



Referenced by Load\-File().

\index{gear\-::\-Ti\-Xml\-Document@{gear\-::\-Ti\-Xml\-Document}!Error\-Id@{Error\-Id}}
\index{Error\-Id@{Error\-Id}!gear::TiXmlDocument@{gear\-::\-Ti\-Xml\-Document}}
\subsubsection[{Error\-Id}]{\setlength{\rightskip}{0pt plus 5cm}int gear\-::\-Ti\-Xml\-Document\-::\-Error\-Id (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}\label{classgear_1_1TiXmlDocument_aa25c1df1e9b900b6b77122728a8964ff}


Generally, you probably want the error string ( \doxyref{Error\-Desc()}{p.}{classgear_1_1TiXmlDocument_a437a1bb7a766af3e135b31f0ba5b257c} ). 

But if you prefer the Error\-Id, this function will fetch it. 

Definition at line 1221 of file tinyxml.\-h.

\index{gear\-::\-Ti\-Xml\-Document@{gear\-::\-Ti\-Xml\-Document}!Error\-Row@{Error\-Row}}
\index{Error\-Row@{Error\-Row}!gear::TiXmlDocument@{gear\-::\-Ti\-Xml\-Document}}
\subsubsection[{Error\-Row}]{\setlength{\rightskip}{0pt plus 5cm}int gear\-::\-Ti\-Xml\-Document\-::\-Error\-Row (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classgear_1_1TiXmlDocument_a0b9ebdb79d42e87f244bb93979643300}


Returns the location (if known) of the error. 

The first column is column 1, and the first row is row 1. A value of 0 means the row and column wasn't applicable (memory errors, for example, have no row/column) or the parser lost the error. (An error in the error reporting, in that case.)

\begin{DoxySeeAlso}{See Also}
\doxyref{Set\-Tab\-Size}{p.}{classgear_1_1TiXmlDocument_abbf7547be9a6daae289b285a83d945ab}, \doxyref{Row}{p.}{classgear_1_1TiXmlBase_ad038736ef7594925a50ad74c0aef5437}, \doxyref{Column}{p.}{classgear_1_1TiXmlBase_a00fb0450124f3e2251e985862108596f} 
\end{DoxySeeAlso}


Definition at line 1230 of file tinyxml.\-h.



Referenced by gear\-::\-Gear\-X\-M\-L\-::create\-Gear\-Mgr().

\index{gear\-::\-Ti\-Xml\-Document@{gear\-::\-Ti\-Xml\-Document}!Load\-File@{Load\-File}}
\index{Load\-File@{Load\-File}!gear::TiXmlDocument@{gear\-::\-Ti\-Xml\-Document}}
\subsubsection[{Load\-File}]{\setlength{\rightskip}{0pt plus 5cm}bool gear\-::\-Ti\-Xml\-Document\-::\-Load\-File (
\begin{DoxyParamCaption}
\item[{Ti\-Xml\-Encoding}]{encoding = {\ttfamily TIXML\-\_\-DEFAULT\-\_\-ENCODING}}
\end{DoxyParamCaption}
)}\label{classgear_1_1TiXmlDocument_a08b2ac1731cbcc837e10de0f64d9cb4f}


Load a file using the current document value. 

Returns true if successful. Will delete any existing document data before loading. 

Definition at line 919 of file tinyxml.\-cc.



Referenced by gear\-::\-Gear\-X\-M\-L\-::create\-Gear\-Mgr(), gear\-::\-Merge\-X\-M\-L\-::set\-File1(), and gear\-::\-Merge\-X\-M\-L\-::set\-File2().

\index{gear\-::\-Ti\-Xml\-Document@{gear\-::\-Ti\-Xml\-Document}!Load\-File@{Load\-File}}
\index{Load\-File@{Load\-File}!gear::TiXmlDocument@{gear\-::\-Ti\-Xml\-Document}}
\subsubsection[{Load\-File}]{\setlength{\rightskip}{0pt plus 5cm}bool gear\-::\-Ti\-Xml\-Document\-::\-Load\-File (
\begin{DoxyParamCaption}
\item[{const std\-::string \&}]{filename, }
\item[{Ti\-Xml\-Encoding}]{encoding = {\ttfamily TIXML\-\_\-DEFAULT\-\_\-ENCODING}}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classgear_1_1TiXmlDocument_aeccf8351e1dac8cbbda39ef7690e8d65}

\begin{DoxyParams}{Parameters}
{\em encoding} & S\-T\-L std\-::string version. \\
\hline
\end{DoxyParams}


Definition at line 1183 of file tinyxml.\-h.

\index{gear\-::\-Ti\-Xml\-Document@{gear\-::\-Ti\-Xml\-Document}!Parse@{Parse}}
\index{Parse@{Parse}!gear::TiXmlDocument@{gear\-::\-Ti\-Xml\-Document}}
\subsubsection[{Parse}]{\setlength{\rightskip}{0pt plus 5cm}const char $\ast$ gear\-::\-Ti\-Xml\-Document\-::\-Parse (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{p, }
\item[{{\bf Ti\-Xml\-Parsing\-Data} $\ast$}]{data = {\ttfamily 0}, }
\item[{Ti\-Xml\-Encoding}]{encoding = {\ttfamily TIXML\-\_\-DEFAULT\-\_\-ENCODING}}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}\label{classgear_1_1TiXmlDocument_a787bc5f6ce91c1bce2b9ea39e0be1c9b}


Parse the given null terminated block of xml data. 

Passing in an encoding to this method (either T\-I\-X\-M\-L\-\_\-\-E\-N\-C\-O\-D\-I\-N\-G\-\_\-\-L\-E\-G\-A\-C\-Y or T\-I\-X\-M\-L\-\_\-\-E\-N\-C\-O\-D\-I\-N\-G\-\_\-\-U\-T\-F8 will force Tiny\-Xml to use that encoding, regardless of what Tiny\-Xml might otherwise try to detect. 

Implements {\bf gear\-::\-Ti\-Xml\-Base} \doxyref{}{p.}{classgear_1_1TiXmlBase}.



Definition at line 689 of file tinyxmlparser.\-cc.



References Clear\-Error(), gear\-::\-Ti\-Xml\-Declaration\-::\-Encoding(), gear\-::\-Ti\-Xml\-Node\-::\-Link\-End\-Child(), and gear\-::\-Ti\-Xml\-Node\-::\-To\-Declaration().



Referenced by Load\-File().

\index{gear\-::\-Ti\-Xml\-Document@{gear\-::\-Ti\-Xml\-Document}!Print@{Print}}
\index{Print@{Print}!gear::TiXmlDocument@{gear\-::\-Ti\-Xml\-Document}}
\subsubsection[{Print}]{\setlength{\rightskip}{0pt plus 5cm}void gear\-::\-Ti\-Xml\-Document\-::\-Print (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}\label{classgear_1_1TiXmlDocument_aa5c816964947bd2a0664f2867e154dda}


Dump the document to standard out. 



Definition at line 1268 of file tinyxml.\-h.



References Print().



Referenced by Print(), and Save\-File().

\index{gear\-::\-Ti\-Xml\-Document@{gear\-::\-Ti\-Xml\-Document}!Root\-Element@{Root\-Element}}
\index{Root\-Element@{Root\-Element}!gear::TiXmlDocument@{gear\-::\-Ti\-Xml\-Document}}
\subsubsection[{Root\-Element}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf Ti\-Xml\-Element}$\ast$ gear\-::\-Ti\-Xml\-Document\-::\-Root\-Element (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}\label{classgear_1_1TiXmlDocument_aefebcfb542d96f74753518ef615b40e6}


Get the root element -- the only top level element -- of the document. 

In well formed X\-M\-L, there should only be one. Tiny\-Xml is tolerant of multiple elements at the document level. 

Definition at line 1205 of file tinyxml.\-h.



References gear\-::\-Ti\-Xml\-Node\-::\-First\-Child\-Element().



Referenced by gear\-::\-Gear\-X\-M\-L\-::create\-Gear\-Mgr().

\index{gear\-::\-Ti\-Xml\-Document@{gear\-::\-Ti\-Xml\-Document}!Set\-Tab\-Size@{Set\-Tab\-Size}}
\index{Set\-Tab\-Size@{Set\-Tab\-Size}!gear::TiXmlDocument@{gear\-::\-Ti\-Xml\-Document}}
\subsubsection[{Set\-Tab\-Size}]{\setlength{\rightskip}{0pt plus 5cm}void gear\-::\-Ti\-Xml\-Document\-::\-Set\-Tab\-Size (
\begin{DoxyParamCaption}
\item[{int}]{\-\_\-tabsize}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classgear_1_1TiXmlDocument_abbf7547be9a6daae289b285a83d945ab}


By calling this method, with a tab size greater than 0, the row and column of each node and attribute is stored when the file is loaded. 

Very useful for tracking the D\-O\-M back in to the source file.

The tab size is required for calculating the location of nodes. If not set, the default of 4 is used. The tabsize is set per document. Setting the tabsize to 0 disables row/column tracking.

Note that row and column tracking is not supported when using operator$>$$>$.

The tab size needs to be enabled before the parse or load. Correct usage\-: \begin{DoxyVerb}    TiXmlDocument doc;
    doc.SetTabSize( 8 );
    doc.Load( "myfile.xml" );\end{DoxyVerb}


\begin{DoxySeeAlso}{See Also}
\doxyref{Row}{p.}{classgear_1_1TiXmlBase_ad038736ef7594925a50ad74c0aef5437}, \doxyref{Column}{p.}{classgear_1_1TiXmlBase_a00fb0450124f3e2251e985862108596f} 
\end{DoxySeeAlso}


Definition at line 1253 of file tinyxml.\-h.



The documentation for this class was generated from the following files\-:\begin{DoxyCompactItemize}
\item 
tinyxml.\-h\item 
tinyxml.\-cc\item 
tinyxmlparser.\-cc\end{DoxyCompactItemize}
