TiXmlDocument Class Reference

Always the top level node. More...

#include <tinyxml.h>

Inheritance diagram for TiXmlDocument:

Inheritance graph
[legend]
Collaboration diagram for TiXmlDocument:

Collaboration graph
[legend]

Public Member Functions

 TiXmlDocument ()
 Create an empty document, that has no name.
 TiXmlDocument (const char *documentName)
 Create a document with a name. The name of the document is also the filename of the xml.
 TiXmlDocument (const std::string &documentName)
 Constructor.
virtual ~TiXmlDocument ()
bool LoadFile ()
 Load a file using the current document value.
bool SaveFile () const
 Save a file using the current document value. Returns true if successful.
bool LoadFile (const char *filename)
 Load a file using the given filename. Returns true if successful.
bool SaveFile (const char *filename) const
 Save a file using the given filename. Returns true if successful.
bool LoadFile (const std::string &filename)
bool SaveFile (const std::string &filename) const
 < STL std::string version.
virtual const char * Parse (const char *p)
 Parse the given null terminated block of xml data.
TiXmlElement * RootElement () const
 Get the root element -- the only top level element -- of the document.
bool Error () const
 If, during parsing, a error occurs, Error will be set to true.
const char * ErrorDesc () const
 Contains a textual (english) description of the error if one occurs.
const int ErrorId () const
 Generally, you probably want the error string ( ErrorDesc() ).
void ClearError ()
 If you have handled the error, it can be reset with this call.
void Print () const
 Dump the document to standard out.
virtual void Print (FILE *cfile, int depth=0) const
 All TinyXml classes can print themselves to a filestream.
void SetError (int err)

Protected Member Functions

virtual void StreamOut (TIXML_OSTREAM *out) const
virtual TiXmlNode * Clone () const
virtual void StreamIn (TIXML_ISTREAM *in, TIXML_STRING *tag)

Private Attributes

bool error
int errorId
TIXML_STRING errorDesc

Detailed Description

Always the top level node.

A document binds together all the XML 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 897 of file tinyxml.h.


Constructor & Destructor Documentation

TiXmlDocument::TiXmlDocument (  ) 

Create an empty document, that has no name.

Definition at line 697 of file tinyxml.cpp.

References error.

Referenced by Clone().

TiXmlDocument::TiXmlDocument ( const char *  documentName  ) 

Create a document with a name. The name of the document is also the filename of the xml.

Definition at line 703 of file tinyxml.cpp.

References error.

TiXmlDocument::TiXmlDocument ( const std::string &  documentName  )  [inline]

Constructor.

Definition at line 907 of file tinyxml.h.

References error.

virtual TiXmlDocument::~TiXmlDocument (  )  [inline, virtual]

Definition at line 915 of file tinyxml.h.


Member Function Documentation

void TiXmlDocument::ClearError (  )  [inline]

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

Definition at line 962 of file tinyxml.h.

References error.

TiXmlNode * TiXmlDocument::Clone (  )  const [protected, virtual]

bool TiXmlDocument::Error (  )  const [inline]

If, during parsing, a error occurs, Error will be set to true.

Definition at line 951 of file tinyxml.h.

References error.

Referenced by LoadFile(), and Ogre::DotSceneLoader::parseDotScene().

const char* TiXmlDocument::ErrorDesc (  )  const [inline]

Contains a textual (english) description of the error if one occurs.

Definition at line 954 of file tinyxml.h.

const int TiXmlDocument::ErrorId (  )  const [inline]

Generally, you probably want the error string ( ErrorDesc() ).

But if you prefer the ErrorId, this function will fetch it.

Definition at line 959 of file tinyxml.h.

bool TiXmlDocument::LoadFile ( const std::string &  filename  )  [inline]

Parameters:
filename  STL std::string version.

Definition at line 930 of file tinyxml.h.

bool TiXmlDocument::LoadFile ( const char *  filename  ) 

Load a file using the given filename. Returns true if successful.

Definition at line 727 of file tinyxml.cpp.

References TiXmlNode::Clear(), Error(), Parse(), SetError(), TiXmlBase::TIXML_ERROR_OPENING_FILE, and TIXML_STRING.

bool TiXmlDocument::LoadFile (  ) 

Load a file using the current document value.

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

Definition at line 710 of file tinyxml.cpp.

const char * TiXmlDocument::Parse ( const char *  p  )  [virtual]

Parse the given null terminated block of xml data.

Implements TiXmlBase.

Definition at line 342 of file tinyxmlparser.cpp.

References TiXmlNode::Identify(), TiXmlNode::LinkEndChild(), TiXmlBase::Parse(), SetError(), TiXmlBase::SkipWhiteSpace(), and TiXmlBase::TIXML_ERROR_DOCUMENT_EMPTY.

Referenced by LoadFile(), and Ogre::DotSceneLoader::parseDotScene().

void TiXmlDocument::Print ( FILE *  cfile,
int  depth = 0 
) const [virtual]

All TinyXml classes can print themselves to a filestream.

This is a formatted print, and will insert tabs and newlines.

(For an unformatted stream, use the << operator.)

Implements TiXmlBase.

Definition at line 816 of file tinyxml.cpp.

References TiXmlNode::FirstChild(), TiXmlNode::NextSibling(), and TiXmlBase::Print().

void TiXmlDocument::Print (  )  const [inline]

Dump the document to standard out.

Definition at line 965 of file tinyxml.h.

References Print().

Referenced by Print(), and SaveFile().

TiXmlElement* TiXmlDocument::RootElement (  )  const [inline]

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

In well formed XML, there should only be one. TinyXml is tolerant of multiple elements at the document level.

Definition at line 948 of file tinyxml.h.

References TiXmlNode::FirstChildElement().

Referenced by Ogre::DotSceneLoader::parseDotScene().

bool TiXmlDocument::SaveFile ( const std::string &  filename  )  const [inline]

< STL std::string version.

Definition at line 934 of file tinyxml.h.

bool TiXmlDocument::SaveFile ( const char *  filename  )  const

Save a file using the given filename. Returns true if successful.

Definition at line 783 of file tinyxml.cpp.

References Print().

bool TiXmlDocument::SaveFile (  )  const

Save a file using the current document value. Returns true if successful.

Definition at line 719 of file tinyxml.cpp.

void TiXmlDocument::SetError ( int  err  )  [inline]

void TiXmlDocument::StreamIn ( TIXML_ISTREAM *  in,
TIXML_STRING *  tag 
) [protected, virtual]

void TiXmlDocument::StreamOut ( TIXML_OSTREAM *  out  )  const [protected, virtual]


Field Documentation

Definition at line 984 of file tinyxml.h.

Referenced by Clone(), and TiXmlDocument().

TIXML_STRING TiXmlDocument::errorDesc [private]

Definition at line 986 of file tinyxml.h.

Referenced by Clone().

Definition at line 985 of file tinyxml.h.


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

Generated on Sun Nov 23 04:12:56 2008 for Sofa by  doxygen 1.5.7.1