#include <XmlDocument.h>
Public Member Functions | |
void | operator= (const XmlDocument ©) |
virtual String | Name () const |
void | Write (TextWriter &xmlout) const |
Save a file using the given filename. Returns true if successful. | |
void | Write (const String &filename) const |
XmlElementPtr | RootElement () |
virtual XmlDocumentPtr | ToDocument () const |
Cast to a more defined type. Will return null not of the requested type. | |
virtual StringPtr | InnerXml () const |
virtual StringPtr | ToString () const |
virtual void | ValidateMem () const |
virtual void | CheckMem () const |
Static Public Member Functions | |
static XmlDocumentPtr | Parse (TextReader &xmlin, XmlParsingData *data=NULL, XmlEncoding encoding=TIXML_DEFAULT_ENCODING) |
Load a file using the given filename. Returns true if successful. | |
static XmlDocumentPtr | Parse (const String &filename) |
static XmlDocumentPtr | ParseXml (const String &xml, XmlParsingData *data=NULL, XmlEncoding encoding=TIXML_DEFAULT_ENCODING) |
static void | SetTabSize (int _tabsize) |
static int | TabSize () |
static void | SetCondenseWhiteSpace (bool condense) |
static bool | CondenseWhiteSpace () |
static bool | IsWhiteSpaceCondensed () |
Protected Member Functions | |
virtual XmlNodePtr | Clone () const |
Performs a deep copy. | |
virtual const char * | _Parse (const char *p, XmlParsingData *data=NULL, XmlEncoding encoding=TIXML_DEFAULT_ENCODING) |
XmlDocument () | |
Create an empty document, that has no name. | |
void | CopyTo (XmlDocument &target) const |
virtual void | WriteTo (TextWriter &writer) const |
Protected Attributes | |
bool | m_useMicrosoftBOM |
the UTF-8 BOM were found when read. Note this, and try to write.public: | |
Static Protected Attributes | |
static bool | m_condenseWhiteSpace = true |
static int | m_tabsize |
Friends | |
void | _TestTinyXml () |
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 47 of file XmlDocument.h.
const char * XmlDocument::_Parse | ( | const char * | p, | |
XmlParsingData * | data = NULL , |
|||
XmlEncoding | encoding = TIXML_DEFAULT_ENCODING | |||
) | [protected, virtual] |
Parse the given null terminated block of xml data. Passing in an encoding to this method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml to use that encoding, regardless of what TinyXml might otherwise try to detect.
Implements XmlNode.
Definition at line 821 of file TinyXmlParser.cpp.
References XmlNode::AppendChild(), and m_useMicrosoftBOM.
XmlElementPtr XmlDocument::RootElement | ( | ) |
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 58 of file TinyXmlDocument.cpp.
References XmlNode::FirstChildElement().
static void XmlDocument::SetTabSize | ( | int | _tabsize | ) | [inline, static] |
SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) to report the correct values for row and column. It does not change the output or input in any way.
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 DOM 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:
TiXmlDocument doc; doc.SetTabSize( 8 ); doc.Load( "myfile.xml" );
Definition at line 139 of file XmlDocument.h.
void XmlDocument::Write | ( | TextWriter & | xmlout | ) | const |
Save a file using the given filename. Returns true if successful.
Load a file using the current document value. Returns true if successful. Will delete any existing document data before loading.
Definition at line 69 of file TinyXmlDocument.cpp.
References m_useMicrosoftBOM.