diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a45e45..7632022 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.15) -project(tinyxml2 VERSION 9.0.0) +project(tinyxml2 VERSION 10.0.0) include(CTest) option(tinyxml2_BUILD_TESTING "Build tests for tinyxml2" "${BUILD_TESTING}") diff --git a/docs/_example_1.html b/docs/_example_1.html index bac9a0c..9659fcb 100644 --- a/docs/_example_1.html +++ b/docs/_example_1.html @@ -1,14 +1,16 @@ - +
- - + +|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
Basic XML file loading. The basic syntax to load an XML file from disk and check for an error. (ErrorID() will return 0 for no error.)
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
Basic XML string parsing. The basic syntax to parse an XML for a char* and check for an error. (ErrorID() will return 0 for no error.)
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
In this example, we navigate a simple XML file, and read some interesting text. Note that this example doesn't use error checking; working code should check for null pointers when walking an XML tree, or use XMLHandle.
@@ -115,7 +123,7 @@ Text "A Midsummer Night's Dream"|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
| ▼Ntinyxml2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CXMLVisitor | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CXMLNode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CXMLText | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CXMLComment | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CXMLDeclaration | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CXMLUnknown | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CXMLAttribute | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CXMLElement | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CXMLDocument | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CXMLHandle | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CXMLConstHandle | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CXMLPrinter | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ▼Ntinyxml2 | |
| CXMLAttribute | |
| CXMLComment | |
| CXMLConstHandle | |
| CXMLDeclaration | |
| CXMLDocument | |
| CXMLElement | |
| CXMLHandle | |
| CXMLNode | |
| CXMLPrinter | |
| CXMLText | |
| CXMLUnknown | |
| CXMLVisitor |
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
This is the complete list of members for tinyxml2::XMLAttribute, including all inherited members.
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
#include <tinyxml2.h>
+Public Member Functions
-const char * | Name () const | | The name of the attribute. | |
-const char * | Value () const | | The value of the attribute. | |
-int | GetLineNum () const |
+const char * | Name () const | | The name of the attribute. | |
+const char * | Value () const | | The value of the attribute. | | |
-const XMLAttribute * | Next () const | | The next attribute in the list. | | int | IntValue () const |
+const XMLAttribute * | Next () const | | The next attribute in the list. | | |
-unsigned | UnsignedValue () const | | Query as an unsigned integer. See IntValue() |
+unsigned | UnsignedValue () const | |
-bool | BoolValue () const | | Query as a boolean. See IntValue() |
+bool | BoolValue () const | |
-double | DoubleValue () const | | Query as a double. See IntValue() |
+double | DoubleValue () const | |
-float | FloatValue () const | | Query as a float. See IntValue() |
+float | FloatValue () const | | XMLError | QueryIntValue (int *value) const | |
-XMLError | QueryUnsignedValue (unsigned int *value) const | |
-XMLError | QueryInt64Value (int64_t *value) const | |
-XMLError | QueryUnsigned64Value (uint64_t *value) const | |
-XMLError | QueryBoolValue (bool *value) const | |
-XMLError | QueryDoubleValue (double *value) const | |
-XMLError | QueryFloatValue (float *value) const | |
-void | SetAttribute (const char *value) | |
-void | SetAttribute (int value) | |
-void | SetAttribute (unsigned value) | |
-void | SetAttribute (int64_t value) | |
-void | SetAttribute (uint64_t value) | |
-void | SetAttribute (bool value) | |
-void | SetAttribute (double value) | |
-void | SetAttribute (float value) | | +int | GetLineNum () const | Gets the line number the attribute is in, if the document was parsed from a file. | int | IntValue () const | Query as an unsigned integer. See IntValue() | Query as a boolean. See IntValue() | Query as a double. See IntValue() | Query as a float. See IntValue() | XMLError | QueryIntValue (int *value) const | +XMLError | QueryUnsignedValue (unsigned int *value) const | See QueryIntValue. | +XMLError | QueryInt64Value (int64_t *value) const | See QueryIntValue. | +XMLError | QueryUnsigned64Value (uint64_t *value) const | See QueryIntValue. | +XMLError | QueryBoolValue (bool *value) const | See QueryIntValue. | +XMLError | QueryDoubleValue (double *value) const | See QueryIntValue. | +XMLError | QueryFloatValue (float *value) const | See QueryIntValue. | +void | SetAttribute (const char *value) | Set the attribute to a string value. | +void | SetAttribute (int value) | Set the attribute to value. | +void | SetAttribute (unsigned value) | Set the attribute to value. | +void | SetAttribute (int64_t value) | Set the attribute to value. | +void | SetAttribute (uint64_t value) | Set the attribute to value. | +void | SetAttribute (bool value) | Set the attribute to value. | +void | SetAttribute (double value) | Set the attribute to value. | +void | SetAttribute (float value) | Set the attribute to value. | ||||||||||||||||||||||||||||||||||||||||||||||||||
An attribute is a name-value pair. Elements have an arbitrary number of attributes, each with a unique name.
-IntValue interprets the attribute as an integer, and returns the value. If the value isn't an integer, 0 will be returned. There is no error checking; use QueryIntValue() if you need error checking.
+IntValue interprets the attribute as an integer, and returns the value. If the value isn't an integer, 0 will be returned. There is no error checking; use QueryIntValue() if you need error checking.
- -|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
This is the complete list of members for tinyxml2::XMLComment, including all inherited members.
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
+Public Member Functions
-virtual XMLComment * | ToComment () | | Safely cast to a Comment, or null. | | virtual bool | Accept (XMLVisitor *visitor) const | | virtual XMLNode * | ShallowClone (XMLDocument *document) const | | virtual bool | ShallowEqual (const XMLNode *compare) const | | Public Member Functions inherited from tinyxml2::XMLNode
-const XMLDocument * | GetDocument () const | | Get the XMLDocument that owns this XMLNode. | |
-XMLDocument * | GetDocument () | | Get the XMLDocument that owns this XMLNode. | |
-virtual XMLElement * | ToElement () | | Safely cast to an Element, or null. | |
-virtual XMLText * | ToText () | | Safely cast to Text, or null. | |
-virtual XMLDocument * | ToDocument () | | Safely cast to a Document, or null. | |
-virtual XMLDeclaration * | ToDeclaration () | | Safely cast to a Declaration, or null. | |
-virtual XMLUnknown * | ToUnknown () | | Safely cast to an Unknown, or null. | | const char * | Value () const | | void | SetValue (const char *val, bool staticMem=false) |
+virtual XMLComment * | ToComment () override | | Safely cast to a Comment, or null. | | virtual bool | Accept (XMLVisitor *visitor) const override | | virtual XMLNode * | ShallowClone (XMLDocument *document) const override | | virtual bool | ShallowEqual (const XMLNode *compare) const override | | Public Member Functions inherited from tinyxml2::XMLNode
+const XMLDocument * | GetDocument () const | | Get the XMLDocument that owns this XMLNode. | |
+XMLDocument * | GetDocument () | | Get the XMLDocument that owns this XMLNode. | |
+virtual XMLElement * | ToElement () | | Safely cast to an Element, or null. | |
+virtual XMLText * | ToText () | | Safely cast to Text, or null. | |
+virtual XMLDocument * | ToDocument () | | Safely cast to a Document, or null. | |
+virtual XMLDeclaration * | ToDeclaration () | | Safely cast to a Declaration, or null. | |
+virtual XMLUnknown * | ToUnknown () | | Safely cast to an Unknown, or null. | | const char * | Value () const | | |
-int | GetLineNum () const | |
-const XMLNode * | Parent () const | | Get the parent of this node on the DOM. | |
-bool | NoChildren () const |
+const XMLNode * | Parent () const | | Get the parent of this node on the DOM. | | |
-const XMLNode * | FirstChild () const | | Get the first child node, or null if none exists. | | const XMLElement * | FirstChildElement (const char *name=0) const | |
-const XMLNode * | LastChild () const | | Get the last child node, or null if none exists. | | const XMLElement * | LastChildElement (const char *name=0) const | |
-const XMLNode * | PreviousSibling () const | | Get the previous (left) sibling node of this node. | |
-const XMLElement * | PreviousSiblingElement (const char *name=0) const | | Get the previous (left) sibling element of this node, with an optionally supplied name. | |
-const XMLNode * | NextSibling () const | | Get the next (right) sibling node of this node. | |
-const XMLElement * | NextSiblingElement (const char *name=0) const | | Get the next (right) sibling element of this node, with an optionally supplied name. | | XMLNode * | InsertEndChild (XMLNode *addThis) | | XMLNode * | InsertFirstChild (XMLNode *addThis) | | XMLNode * | InsertAfterChild (XMLNode *afterThis, XMLNode *addThis) | | void | DeleteChildren () |
+const XMLNode * | FirstChild () const | | Get the first child node, or null if none exists. | | const XMLElement * | FirstChildElement (const char *name=0) const | |
+const XMLNode * | LastChild () const | | Get the last child node, or null if none exists. | | const XMLElement * | LastChildElement (const char *name=0) const | |
+const XMLNode * | PreviousSibling () const | | Get the previous (left) sibling node of this node. | |
+const XMLElement * | PreviousSiblingElement (const char *name=0) const | | Get the previous (left) sibling element of this node, with an optionally supplied name. | |
+const XMLNode * | NextSibling () const | | Get the next (right) sibling node of this node. | |
+const XMLElement * | NextSiblingElement (const char *name=0) const | | Get the next (right) sibling element of this node, with an optionally supplied name. | | XMLNode * | InsertEndChild (XMLNode *addThis) | | XMLNode * | InsertFirstChild (XMLNode *addThis) | | XMLNode * | InsertAfterChild (XMLNode *afterThis, XMLNode *addThis) | | | void | DeleteChild (XMLNode *node) | | XMLNode * | DeepClone (XMLDocument *target) const | | void | SetUserData (void *userData) | XMLNode * | DeepClone (XMLDocument *target) const | | | void * | GetUserData () const | | void * | GetUserData () const | | void | SetValue (const char *val, bool staticMem=false) | +int | GetLineNum () const | Gets the line number the node is in, if the document was parsed from a file. | +bool | NoChildren () const | Returns true if this node has no children. | void | DeleteChildren () | void | DeleteChild (XMLNode *node) | void | SetUserData (void *userData) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
An XML Comment.
Which are both good references for "visiting".
-An example of using Accept():
XMLPrinter printer; +An example of using Accept():
XMLPrinter printer; tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr();@@ -229,8 +236,8 @@ const char* xmlcstr = printer.CStr();
| virtual XMLNode* tinyxml2::XMLComment::ShallowClone | +virtual XMLNode * tinyxml2::XMLComment::ShallowClone | ( | -XMLDocument * | -document | ) | +XMLDocument * | document | ) | const |
Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the 'document' is null, then the node returned will be allocated from the current Document. (this->GetDocument())
+Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the 'document' is null, then the node returned will be allocated from the current Document. (this->GetDocument())
Note: if called on a XMLDocument, this will return null.
-Implements tinyxml2::XMLNode.
+Implements tinyxml2::XMLNode.
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
+Public Member Functions
-virtual XMLDeclaration * | ToDeclaration () | | Safely cast to a Declaration, or null. | | virtual bool | Accept (XMLVisitor *visitor) const | | virtual XMLNode * | ShallowClone (XMLDocument *document) const | | virtual bool | ShallowEqual (const XMLNode *compare) const | | Public Member Functions inherited from tinyxml2::XMLNode
-const XMLDocument * | GetDocument () const | | Get the XMLDocument that owns this XMLNode. | |
-XMLDocument * | GetDocument () | | Get the XMLDocument that owns this XMLNode. | |
-virtual XMLElement * | ToElement () | | Safely cast to an Element, or null. | |
-virtual XMLText * | ToText () | | Safely cast to Text, or null. | |
-virtual XMLComment * | ToComment () | | Safely cast to a Comment, or null. | |
-virtual XMLDocument * | ToDocument () | | Safely cast to a Document, or null. | |
-virtual XMLUnknown * | ToUnknown () | | Safely cast to an Unknown, or null. | | const char * | Value () const | | void | SetValue (const char *val, bool staticMem=false) |
+virtual XMLDeclaration * | ToDeclaration () override | | Safely cast to a Declaration, or null. | | virtual bool | Accept (XMLVisitor *visitor) const override | | virtual XMLNode * | ShallowClone (XMLDocument *document) const override | | virtual bool | ShallowEqual (const XMLNode *compare) const override | | Public Member Functions inherited from tinyxml2::XMLNode
+const XMLDocument * | GetDocument () const | | Get the XMLDocument that owns this XMLNode. | |
+XMLDocument * | GetDocument () | | Get the XMLDocument that owns this XMLNode. | |
+virtual XMLElement * | ToElement () | | Safely cast to an Element, or null. | |
+virtual XMLText * | ToText () | | Safely cast to Text, or null. | |
+virtual XMLComment * | ToComment () | | Safely cast to a Comment, or null. | |
+virtual XMLDocument * | ToDocument () | | Safely cast to a Document, or null. | |
+virtual XMLUnknown * | ToUnknown () | | Safely cast to an Unknown, or null. | | const char * | Value () const | | |
-int | GetLineNum () const | |
-const XMLNode * | Parent () const | | Get the parent of this node on the DOM. | |
-bool | NoChildren () const |
+const XMLNode * | Parent () const | | Get the parent of this node on the DOM. | | |
-const XMLNode * | FirstChild () const | | Get the first child node, or null if none exists. | | const XMLElement * | FirstChildElement (const char *name=0) const | |
-const XMLNode * | LastChild () const | | Get the last child node, or null if none exists. | | const XMLElement * | LastChildElement (const char *name=0) const | |
-const XMLNode * | PreviousSibling () const | | Get the previous (left) sibling node of this node. | |
-const XMLElement * | PreviousSiblingElement (const char *name=0) const | | Get the previous (left) sibling element of this node, with an optionally supplied name. | |
-const XMLNode * | NextSibling () const | | Get the next (right) sibling node of this node. | |
-const XMLElement * | NextSiblingElement (const char *name=0) const | | Get the next (right) sibling element of this node, with an optionally supplied name. | | XMLNode * | InsertEndChild (XMLNode *addThis) | | XMLNode * | InsertFirstChild (XMLNode *addThis) | | XMLNode * | InsertAfterChild (XMLNode *afterThis, XMLNode *addThis) | | void | DeleteChildren () |
+const XMLNode * | FirstChild () const | | Get the first child node, or null if none exists. | | const XMLElement * | FirstChildElement (const char *name=0) const | |
+const XMLNode * | LastChild () const | | Get the last child node, or null if none exists. | | const XMLElement * | LastChildElement (const char *name=0) const | |
+const XMLNode * | PreviousSibling () const | | Get the previous (left) sibling node of this node. | |
+const XMLElement * | PreviousSiblingElement (const char *name=0) const | | Get the previous (left) sibling element of this node, with an optionally supplied name. | |
+const XMLNode * | NextSibling () const | | Get the next (right) sibling node of this node. | |
+const XMLElement * | NextSiblingElement (const char *name=0) const | | Get the next (right) sibling element of this node, with an optionally supplied name. | | XMLNode * | InsertEndChild (XMLNode *addThis) | | XMLNode * | InsertFirstChild (XMLNode *addThis) | | XMLNode * | InsertAfterChild (XMLNode *afterThis, XMLNode *addThis) | | | void | DeleteChild (XMLNode *node) | | XMLNode * | DeepClone (XMLDocument *target) const | | void | SetUserData (void *userData) | XMLNode * | DeepClone (XMLDocument *target) const | | | void * | GetUserData () const | | void * | GetUserData () const | | void | SetValue (const char *val, bool staticMem=false) | +int | GetLineNum () const | Gets the line number the node is in, if the document was parsed from a file. | +bool | NoChildren () const | Returns true if this node has no children. | void | DeleteChildren () | void | DeleteChild (XMLNode *node) | void | SetUserData (void *userData) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
In correct XML the declaration is the first entry in the file.
<?xml version="1.0" standalone="yes"?>
TinyXML-2 will happily read or write files without a declaration, however.
The text of the declaration isn't interpreted. It is parsed and written as a string.
Which are both good references for "visiting".
-An example of using Accept():
XMLPrinter printer; +An example of using Accept():
XMLPrinter printer; tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr();@@ -231,8 +238,8 @@ const char* xmlcstr = printer.CStr();
| virtual XMLNode* tinyxml2::XMLDeclaration::ShallowClone | +virtual XMLNode * tinyxml2::XMLDeclaration::ShallowClone | ( | -XMLDocument * | -document | ) | +XMLDocument * | document | ) | const |
Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the 'document' is null, then the node returned will be allocated from the current Document. (this->GetDocument())
+Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the 'document' is null, then the node returned will be allocated from the current Document. (this->GetDocument())
Note: if called on a XMLDocument, this will return null.
-Implements tinyxml2::XMLNode.
+Implements tinyxml2::XMLNode.
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
This is the complete list of members for tinyxml2::XMLDocument, including all inherited members.
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
+Public Member Functions
- | XMLDocument (bool processEntities=true, Whitespace whitespaceMode=PRESERVE_WHITESPACE) | |
-virtual XMLDocument * | ToDocument () | | Safely cast to a Document, or null. | | XMLError | Parse (const char *xml, size_t nBytes=static_cast< size_t >(-1)) |
+virtual XMLDocument * | ToDocument () override | | Safely cast to a Document, or null. | | | XMLError | LoadFile (const char *filename) | | XMLError | LoadFile (FILE *) | | XMLError | SaveFile (const char *filename, bool compact=false) | | XMLError | SaveFile (FILE *fp, bool compact=false) | | bool | HasBOM () const | | void | SetBOM (bool useBOM) | | XMLElement * | RootElement () | | void | Print (XMLPrinter *streamer=0) const | XMLElement * | RootElement () | | | virtual bool | Accept (XMLVisitor *visitor) const | | XMLElement * | NewElement (const char *name) | | XMLComment * | NewComment (const char *comment) | | XMLText * | NewText (const char *text) | | XMLDeclaration * | NewDeclaration (const char *text=0) | | XMLUnknown * | NewUnknown (const char *text) | | void | DeleteNode (XMLNode *node) | virtual bool | Accept (XMLVisitor *visitor) const override | | XMLElement * | NewElement (const char *name) | | XMLComment * | NewComment (const char *comment) | | XMLText * | NewText (const char *text) | | XMLDeclaration * | NewDeclaration (const char *text=0) | | XMLUnknown * | NewUnknown (const char *text) | | |
-void | ClearError () | |
-bool | Error () const | |
-XMLError | ErrorID () const | | const char * | ErrorStr () const | |
-void | PrintError () const | | A (trivial) utility function that prints the ErrorStr() to stdout. | const char * | ErrorStr () const | |
+void | PrintError () const | |
-int | ErrorLineNum () const | |
-void | Clear () | | void | DeepCopy (XMLDocument *target) const | | virtual XMLNode * | ShallowClone (XMLDocument *) const | | virtual bool | ShallowEqual (const XMLNode *) const | | Public Member Functions inherited from tinyxml2::XMLNode
-const XMLDocument * | GetDocument () const | | Get the XMLDocument that owns this XMLNode. | |
-XMLDocument * | GetDocument () | | Get the XMLDocument that owns this XMLNode. | |
-virtual XMLElement * | ToElement () | | Safely cast to an Element, or null. | |
-virtual XMLText * | ToText () | | Safely cast to Text, or null. | |
-virtual XMLComment * | ToComment () | | Safely cast to a Comment, or null. | |
-virtual XMLDeclaration * | ToDeclaration () | | Safely cast to a Declaration, or null. | |
-virtual XMLUnknown * | ToUnknown () | | Safely cast to an Unknown, or null. | | const char * | Value () const | | void | SetValue (const char *val, bool staticMem=false) | virtual XMLNode * | ShallowClone (XMLDocument *) const override | | virtual bool | ShallowEqual (const XMLNode *) const override | | Public Member Functions inherited from tinyxml2::XMLNode
+const XMLDocument * | GetDocument () const | | Get the XMLDocument that owns this XMLNode. | |
+XMLDocument * | GetDocument () | | Get the XMLDocument that owns this XMLNode. | |
+virtual XMLElement * | ToElement () | | Safely cast to an Element, or null. | |
+virtual XMLText * | ToText () | | Safely cast to Text, or null. | |
+virtual XMLComment * | ToComment () | | Safely cast to a Comment, or null. | |
+virtual XMLDeclaration * | ToDeclaration () | | Safely cast to a Declaration, or null. | |
+virtual XMLUnknown * | ToUnknown () | | Safely cast to an Unknown, or null. | | const char * | Value () const | | |
-int | GetLineNum () const | |
-const XMLNode * | Parent () const | | Get the parent of this node on the DOM. | |
-bool | NoChildren () const |
+const XMLNode * | Parent () const | | Get the parent of this node on the DOM. | | |
-const XMLNode * | FirstChild () const | | Get the first child node, or null if none exists. | | const XMLElement * | FirstChildElement (const char *name=0) const | |
-const XMLNode * | LastChild () const | | Get the last child node, or null if none exists. | | const XMLElement * | LastChildElement (const char *name=0) const | |
-const XMLNode * | PreviousSibling () const | | Get the previous (left) sibling node of this node. | |
-const XMLElement * | PreviousSiblingElement (const char *name=0) const | | Get the previous (left) sibling element of this node, with an optionally supplied name. | |
-const XMLNode * | NextSibling () const | | Get the next (right) sibling node of this node. | |
-const XMLElement * | NextSiblingElement (const char *name=0) const | | Get the next (right) sibling element of this node, with an optionally supplied name. | | XMLNode * | InsertEndChild (XMLNode *addThis) | | XMLNode * | InsertFirstChild (XMLNode *addThis) | | XMLNode * | InsertAfterChild (XMLNode *afterThis, XMLNode *addThis) | | void | DeleteChildren () |
+const XMLNode * | FirstChild () const | | Get the first child node, or null if none exists. | | const XMLElement * | FirstChildElement (const char *name=0) const | |
+const XMLNode * | LastChild () const | | Get the last child node, or null if none exists. | | const XMLElement * | LastChildElement (const char *name=0) const | |
+const XMLNode * | PreviousSibling () const | | Get the previous (left) sibling node of this node. | |
+const XMLElement * | PreviousSiblingElement (const char *name=0) const | | Get the previous (left) sibling element of this node, with an optionally supplied name. | |
+const XMLNode * | NextSibling () const | | Get the next (right) sibling node of this node. | |
+const XMLElement * | NextSiblingElement (const char *name=0) const | | Get the next (right) sibling element of this node, with an optionally supplied name. | | XMLNode * | InsertEndChild (XMLNode *addThis) | | XMLNode * | InsertFirstChild (XMLNode *addThis) | | XMLNode * | InsertAfterChild (XMLNode *afterThis, XMLNode *addThis) | | | void | DeleteChild (XMLNode *node) | | XMLNode * | DeepClone (XMLDocument *target) const | | void | SetUserData (void *userData) | XMLNode * | DeepClone (XMLDocument *target) const | | | void * | GetUserData () const | | void * | GetUserData () const | | + | XMLDocument (bool processEntities=true, Whitespace whitespaceMode=PRESERVE_WHITESPACE) | constructor | XMLError | Parse (const char *xml, size_t nBytes=static_cast< size_t >(-1)) | XMLError | LoadFile (const char *filename) | XMLError | LoadFile (FILE *) | XMLError | SaveFile (const char *filename, bool compact=false) | XMLError | SaveFile (FILE *fp, bool compact=false) | bool | HasBOM () const | void | SetBOM (bool useBOM) | void | Print (XMLPrinter *streamer=0) const | void | DeleteNode (XMLNode *node) | +void | ClearError () | Clears the error flags. | +bool | Error () const | Return true if there was an error parsing the document. | +XMLError | ErrorID () const | Return the errorID. | A (trivial) utility function that prints the ErrorStr() to stdout. | +int | ErrorLineNum () const | Return the line where the error occurred, or zero if unknown. | +void | Clear () | Clear the document, resetting it to the initial state. | void | DeepCopy (XMLDocument *target) const | void | SetValue (const char *val, bool staticMem=false) | +int | GetLineNum () const | Gets the line number the node is in, if the document was parsed from a file. | +bool | NoChildren () const | Returns true if this node has no children. | void | DeleteChildren () | void | DeleteChild (XMLNode *node) | void | SetUserData (void *userData) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A Document binds together all the functionality. It can be saved, loaded, and printed to the screen. All Nodes are connected and allocated to a Document. If the Document is deleted, all its Nodes are also deleted.
Which are both good references for "visiting".
-An example of using Accept():
XMLPrinter printer; +An example of using Accept():
XMLPrinter printer; tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr();@@ -291,8 +298,8 @@ const char* xmlcstr = printer.CStr();
Copies this document to a target document. The target will be completely cleared before the copy. If you want to copy a sub-tree, see XMLNode::DeepClone().
+Copies this document to a target document. The target will be completely cleared before the copy. If you want to copy a sub-tree, see XMLNode::DeepClone().
NOTE: that the 'target' must be non-null.
| const char* tinyxml2::XMLDocument::ErrorStr | +const char * tinyxml2::XMLDocument::ErrorStr | ( | -) | +) | const |
| XMLComment* tinyxml2::XMLDocument::NewComment | +XMLComment * tinyxml2::XMLDocument::NewComment | ( | -const char * | -comment | ) | +const char * | comment | ) |
| XMLDeclaration* tinyxml2::XMLDocument::NewDeclaration | +XMLDeclaration * tinyxml2::XMLDocument::NewDeclaration | ( | -const char * | -text = 0 | ) | +const char * | text = 0 | ) |
| XMLElement* tinyxml2::XMLDocument::NewElement | +XMLElement * tinyxml2::XMLDocument::NewElement | ( | -const char * | -name | ) | +const char * | name | ) |
| XMLUnknown* tinyxml2::XMLDocument::NewUnknown | +XMLUnknown * tinyxml2::XMLDocument::NewUnknown | ( | -const char * | -text | ) | +const char * | text | ) |
static_cast< size_t >(-1) 0| XMLElement* tinyxml2::XMLDocument::RootElement | +XMLElement * tinyxml2::XMLDocument::RootElement | ( | -) | +) |
Return the root element of DOM. Equivalent to FirstChildElement(). To get the first node, use FirstChild().
+Return the root element of DOM. Equivalent to FirstChildElement(). To get the first node, use FirstChild().
false false | virtual XMLNode* tinyxml2::XMLDocument::ShallowClone | +virtual XMLNode * tinyxml2::XMLDocument::ShallowClone | ( | -XMLDocument * | -document | ) | +XMLDocument * | document | ) | const |
Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the 'document' is null, then the node returned will be allocated from the current Document. (this->GetDocument())
+Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the 'document' is null, then the node returned will be allocated from the current Document. (this->GetDocument())
Note: if called on a XMLDocument, this will return null.
-Implements tinyxml2::XMLNode.
+Implements tinyxml2::XMLNode.
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
This is the complete list of members for tinyxml2::XMLElement, including all inherited members.
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
+Public Member Functions
-const char * | Name () const | | Get the name of an element (which is the Value() of the node.) | |
-void | SetName (const char *str, bool staticMem=false) |
+const char * | Name () const | | Get the name of an element (which is the Value() of the node.) | | |
-virtual XMLElement * | ToElement () | | Safely cast to an Element, or null. | | virtual bool | Accept (XMLVisitor *visitor) const | | const char * | Attribute (const char *name, const char *value=0) const | | int | IntAttribute (const char *name, int defaultValue=0) const |
+virtual XMLElement * | ToElement () override | | Safely cast to an Element, or null. | | virtual bool | Accept (XMLVisitor *visitor) const override | | const char * | Attribute (const char *name, const char *value=0) const | | |
-unsigned | UnsignedAttribute (const char *name, unsigned defaultValue=0) const | | See IntAttribute() |
+unsigned | UnsignedAttribute (const char *name, unsigned defaultValue=0) const | |
-int64_t | Int64Attribute (const char *name, int64_t defaultValue=0) const | | See IntAttribute() |
+int64_t | Int64Attribute (const char *name, int64_t defaultValue=0) const | |
-uint64_t | Unsigned64Attribute (const char *name, uint64_t defaultValue=0) const | | See IntAttribute() |
+uint64_t | Unsigned64Attribute (const char *name, uint64_t defaultValue=0) const | |
-bool | BoolAttribute (const char *name, bool defaultValue=false) const | | See IntAttribute() |
+bool | BoolAttribute (const char *name, bool defaultValue=false) const | |
-double | DoubleAttribute (const char *name, double defaultValue=0) const | | See IntAttribute() |
+double | DoubleAttribute (const char *name, double defaultValue=0) const | |
-float | FloatAttribute (const char *name, float defaultValue=0) const | | See IntAttribute() |
+float | FloatAttribute (const char *name, float defaultValue=0) const | | XMLError | QueryIntAttribute (const char *name, int *value) const | |
-XMLError | QueryUnsignedAttribute (const char *name, unsigned int *value) const | | See QueryIntAttribute() |
+XMLError | QueryUnsignedAttribute (const char *name, unsigned int *value) const | |
-XMLError | QueryInt64Attribute (const char *name, int64_t *value) const | | See QueryIntAttribute() |
+XMLError | QueryInt64Attribute (const char *name, int64_t *value) const | |
-XMLError | QueryUnsigned64Attribute (const char *name, uint64_t *value) const | | See QueryIntAttribute() |
+XMLError | QueryUnsigned64Attribute (const char *name, uint64_t *value) const | |
-XMLError | QueryBoolAttribute (const char *name, bool *value) const | | See QueryIntAttribute() |
+XMLError | QueryBoolAttribute (const char *name, bool *value) const | |
-XMLError | QueryDoubleAttribute (const char *name, double *value) const | | See QueryIntAttribute() |
+XMLError | QueryDoubleAttribute (const char *name, double *value) const | |
-XMLError | QueryFloatAttribute (const char *name, float *value) const | | See QueryIntAttribute() |
+XMLError | QueryFloatAttribute (const char *name, float *value) const | |
-XMLError | QueryStringAttribute (const char *name, const char **value) const | | See QueryIntAttribute() |
+XMLError | QueryStringAttribute (const char *name, const char **value) const | | XMLError | QueryAttribute (const char *name, int *value) const | |
-void | SetAttribute (const char *name, const char *value) | |
-void | SetAttribute (const char *name, int value) | |
-void | SetAttribute (const char *name, unsigned value) | |
-void | SetAttribute (const char *name, int64_t value) | |
-void | SetAttribute (const char *name, uint64_t value) | |
-void | SetAttribute (const char *name, bool value) | |
-void | SetAttribute (const char *name, double value) | |
-void | SetAttribute (const char *name, float value) | | void | DeleteAttribute (const char *name) | |
-const XMLAttribute * | FirstAttribute () const | | Return the first attribute in the list. | |
-const XMLAttribute * | FindAttribute (const char *name) const | | Query a specific attribute in the list. | | const char * | GetText () const | | void | SetText (const char *inText) |
+const XMLAttribute * | FirstAttribute () const | | Return the first attribute in the list. | |
+const XMLAttribute * | FindAttribute (const char *name) const | | Query a specific attribute in the list. | | const char * | GetText () const | | |
-void | SetText (int value) | | Convenience method for setting text inside an element. See SetText() for important limitations. |
+void | SetText (int value) | |
-void | SetText (unsigned value) | | Convenience method for setting text inside an element. See SetText() for important limitations. |
+void | SetText (unsigned value) | |
-void | SetText (int64_t value) | | Convenience method for setting text inside an element. See SetText() for important limitations. |
+void | SetText (int64_t value) | |
-void | SetText (uint64_t value) | | Convenience method for setting text inside an element. See SetText() for important limitations. |
+void | SetText (uint64_t value) | |
-void | SetText (bool value) | | Convenience method for setting text inside an element. See SetText() for important limitations. |
+void | SetText (bool value) | |
-void | SetText (double value) | | Convenience method for setting text inside an element. See SetText() for important limitations. |
+void | SetText (double value) | |
-void | SetText (float value) | | Convenience method for setting text inside an element. See SetText() for important limitations. |
+void | SetText (float value) | | XMLError | QueryIntText (int *ival) const | |
-XMLError | QueryUnsignedText (unsigned *uval) const | | See QueryIntText() |
+XMLError | QueryUnsignedText (unsigned *uval) const | |
-XMLError | QueryInt64Text (int64_t *uval) const | | See QueryIntText() |
+XMLError | QueryInt64Text (int64_t *uval) const | |
-XMLError | QueryUnsigned64Text (uint64_t *uval) const | | See QueryIntText() |
+XMLError | QueryUnsigned64Text (uint64_t *uval) const | |
-XMLError | QueryBoolText (bool *bval) const | | See QueryIntText() |
+XMLError | QueryBoolText (bool *bval) const | |
-XMLError | QueryDoubleText (double *dval) const | | See QueryIntText() |
+XMLError | QueryDoubleText (double *dval) const | |
-XMLError | QueryFloatText (float *fval) const | | See QueryIntText() |
+XMLError | QueryFloatText (float *fval) const | |
-unsigned | UnsignedText (unsigned defaultValue=0) const | | See QueryIntText() |
+unsigned | UnsignedText (unsigned defaultValue=0) const | |
-int64_t | Int64Text (int64_t defaultValue=0) const | | See QueryIntText() |
+int64_t | Int64Text (int64_t defaultValue=0) const | |
-uint64_t | Unsigned64Text (uint64_t defaultValue=0) const | | See QueryIntText() |
+uint64_t | Unsigned64Text (uint64_t defaultValue=0) const | |
-bool | BoolText (bool defaultValue=false) const | | See QueryIntText() |
+bool | BoolText (bool defaultValue=false) const | |
-double | DoubleText (double defaultValue=0) const | | See QueryIntText() |
+double | DoubleText (double defaultValue=0) const | |
-float | FloatText (float defaultValue=0) const | | See QueryIntText() |
+float | FloatText (float defaultValue=0) const | | XMLElement * | InsertNewChildElement (const char *name) | |
-XMLComment * | InsertNewComment (const char *comment) | | See InsertNewChildElement() | |
-XMLText * | InsertNewText (const char *text) | | See InsertNewChildElement() | |
-XMLDeclaration * | InsertNewDeclaration (const char *text) | | See InsertNewChildElement() | |
-XMLUnknown * | InsertNewUnknown (const char *text) | | See InsertNewChildElement() | | virtual XMLNode * | ShallowClone (XMLDocument *document) const | | virtual bool | ShallowEqual (const XMLNode *compare) const | | Public Member Functions inherited from tinyxml2::XMLNode
-const XMLDocument * | GetDocument () const | | Get the XMLDocument that owns this XMLNode. | |
-XMLDocument * | GetDocument () | | Get the XMLDocument that owns this XMLNode. | |
-virtual XMLText * | ToText () | | Safely cast to Text, or null. | |
-virtual XMLComment * | ToComment () | | Safely cast to a Comment, or null. | |
-virtual XMLDocument * | ToDocument () | | Safely cast to a Document, or null. | |
-virtual XMLDeclaration * | ToDeclaration () | | Safely cast to a Declaration, or null. | |
-virtual XMLUnknown * | ToUnknown () | | Safely cast to an Unknown, or null. | | const char * | Value () const | | void | SetValue (const char *val, bool staticMem=false) | XMLElement * | InsertNewChildElement (const char *name) | |
+XMLComment * | InsertNewComment (const char *comment) | | See InsertNewChildElement() | |
+XMLText * | InsertNewText (const char *text) | | See InsertNewChildElement() | |
+XMLDeclaration * | InsertNewDeclaration (const char *text) | | See InsertNewChildElement() | |
+XMLUnknown * | InsertNewUnknown (const char *text) | | See InsertNewChildElement() | | virtual XMLNode * | ShallowClone (XMLDocument *document) const override | | virtual bool | ShallowEqual (const XMLNode *compare) const override | | Public Member Functions inherited from tinyxml2::XMLNode
+const XMLDocument * | GetDocument () const | | Get the XMLDocument that owns this XMLNode. | |
+XMLDocument * | GetDocument () | | Get the XMLDocument that owns this XMLNode. | |
+virtual XMLText * | ToText () | | Safely cast to Text, or null. | |
+virtual XMLComment * | ToComment () | | Safely cast to a Comment, or null. | |
+virtual XMLDocument * | ToDocument () | | Safely cast to a Document, or null. | |
+virtual XMLDeclaration * | ToDeclaration () | | Safely cast to a Declaration, or null. | |
+virtual XMLUnknown * | ToUnknown () | | Safely cast to an Unknown, or null. | | const char * | Value () const | | |
-int | GetLineNum () const | |
-const XMLNode * | Parent () const | | Get the parent of this node on the DOM. | |
-bool | NoChildren () const |
+const XMLNode * | Parent () const | | Get the parent of this node on the DOM. | | |
-const XMLNode * | FirstChild () const | | Get the first child node, or null if none exists. | | const XMLElement * | FirstChildElement (const char *name=0) const | |
-const XMLNode * | LastChild () const | | Get the last child node, or null if none exists. | | const XMLElement * | LastChildElement (const char *name=0) const | |
-const XMLNode * | PreviousSibling () const | | Get the previous (left) sibling node of this node. | |
-const XMLElement * | PreviousSiblingElement (const char *name=0) const | | Get the previous (left) sibling element of this node, with an optionally supplied name. | |
-const XMLNode * | NextSibling () const | | Get the next (right) sibling node of this node. | |
-const XMLElement * | NextSiblingElement (const char *name=0) const | | Get the next (right) sibling element of this node, with an optionally supplied name. | | XMLNode * | InsertEndChild (XMLNode *addThis) | | XMLNode * | InsertFirstChild (XMLNode *addThis) | | XMLNode * | InsertAfterChild (XMLNode *afterThis, XMLNode *addThis) | | void | DeleteChildren () |
+const XMLNode * | FirstChild () const | | Get the first child node, or null if none exists. | | const XMLElement * | FirstChildElement (const char *name=0) const | |
+const XMLNode * | LastChild () const | | Get the last child node, or null if none exists. | | const XMLElement * | LastChildElement (const char *name=0) const | |
+const XMLNode * | PreviousSibling () const | | Get the previous (left) sibling node of this node. | |
+const XMLElement * | PreviousSiblingElement (const char *name=0) const | | Get the previous (left) sibling element of this node, with an optionally supplied name. | |
+const XMLNode * | NextSibling () const | | Get the next (right) sibling node of this node. | |
+const XMLElement * | NextSiblingElement (const char *name=0) const | | Get the next (right) sibling element of this node, with an optionally supplied name. | | XMLNode * | InsertEndChild (XMLNode *addThis) | | XMLNode * | InsertFirstChild (XMLNode *addThis) | | XMLNode * | InsertAfterChild (XMLNode *afterThis, XMLNode *addThis) | | | void | DeleteChild (XMLNode *node) | | XMLNode * | DeepClone (XMLDocument *target) const | | void | SetUserData (void *userData) | XMLNode * | DeepClone (XMLDocument *target) const | | | void * | GetUserData () const | | void * | GetUserData () const | | +void | SetName (const char *str, bool staticMem=false) | Set the name of the element. | int | IntAttribute (const char *name, int defaultValue=0) const | See IntAttribute() | See IntAttribute() | See IntAttribute() | See IntAttribute() | See IntAttribute() | See IntAttribute() | XMLError | QueryIntAttribute (const char *name, int *value) const | See QueryIntAttribute() | See QueryIntAttribute() | See QueryIntAttribute() | See QueryIntAttribute() | See QueryIntAttribute() | See QueryIntAttribute() | See QueryIntAttribute() | XMLError | QueryAttribute (const char *name, int *value) const | +void | SetAttribute (const char *name, const char *value) | Sets the named attribute to value. | +void | SetAttribute (const char *name, int value) | Sets the named attribute to value. | +void | SetAttribute (const char *name, unsigned value) | Sets the named attribute to value. | +void | SetAttribute (const char *name, int64_t value) | Sets the named attribute to value. | +void | SetAttribute (const char *name, uint64_t value) | Sets the named attribute to value. | +void | SetAttribute (const char *name, bool value) | Sets the named attribute to value. | +void | SetAttribute (const char *name, double value) | Sets the named attribute to value. | +void | SetAttribute (const char *name, float value) | Sets the named attribute to value. | void | DeleteAttribute (const char *name) | void | SetText (const char *inText) | Convenience method for setting text inside an element. See SetText() for important limitations. | Convenience method for setting text inside an element. See SetText() for important limitations. | Convenience method for setting text inside an element. See SetText() for important limitations. | Convenience method for setting text inside an element. See SetText() for important limitations. | Convenience method for setting text inside an element. See SetText() for important limitations. | Convenience method for setting text inside an element. See SetText() for important limitations. | Convenience method for setting text inside an element. See SetText() for important limitations. | XMLError | QueryIntText (int *ival) const | See QueryIntText() | See QueryIntText() | See QueryIntText() | See QueryIntText() | See QueryIntText() | See QueryIntText() | See QueryIntText() | See QueryIntText() | See QueryIntText() | See QueryIntText() | See QueryIntText() | See QueryIntText() | void | SetValue (const char *val, bool staticMem=false) | +int | GetLineNum () const | Gets the line number the node is in, if the document was parsed from a file. | +bool | NoChildren () const | Returns true if this node has no children. | void | DeleteChildren () | void | DeleteChild (XMLNode *node) | void | SetUserData (void *userData) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The element is a container class. It has a value, the element name, and can contain other elements, text, comments, and unknowns. Elements also contain an arbitrary number of attributes.
Which are both good references for "visiting".
-An example of using Accept():
XMLPrinter printer; +An example of using Accept():
XMLPrinter printer; tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr();@@ -439,32 +446,25 @@ const char* xmlcstr = printer.CStr();
| const char* tinyxml2::XMLElement::Attribute | +const char * tinyxml2::XMLElement::Attribute | ( | -const char * | -name, | +const char * | name, |
| - | const char * | -value = 0 |
- ||||
| - | ) | -const | +const char * | value = 0 ) const |
Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists. For example:
+Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists. For example:
const char* value = ele->Attribute( "foo" );
The 'value' parameter is normally null. However, if specified, the attribute will only be returned if the 'name' and 'value' match. This allow you to write code:
if ( ele->Attribute( "foo", "bar" ) ) callFooIsBar(); @@ -474,8 +474,8 @@ const char* xmlcstr = printer.CStr();
| const char* tinyxml2::XMLElement::GetText | +const char * tinyxml2::XMLElement::GetText | ( | -) | +) | const |
Convenience function for easy access to the text inside an element. Although easy and concise, GetText() is limited compared to getting the XMLText child and accessing it directly.
-If the first child of 'this' is a XMLText, the GetText() returns the character string of the Text node, else null is returned.
+Convenience function for easy access to the text inside an element. Although easy and concise, GetText() is limited compared to getting the XMLText child and accessing it directly.
+If the first child of 'this' is a XMLText, the GetText() returns the character string of the Text node, else null is returned.
This is a convenient method for getting the text of simple contained text:
<foo>This is text</foo>
const char* str = fooElement->GetText();
'str' will be a pointer to "This is text".
Note that this function can be misleading. If the element foo was created from this XML:
<foo><b>This is text</b></foo>
then the value of str would be null. The first child node isn't a text node, it is another element. From this XML:
<foo>This is <b>text</b></foo> -
GetText() will return "This is ".
+GetText() will return "This is ".
| XMLElement* tinyxml2::XMLElement::InsertNewChildElement | +XMLElement * tinyxml2::XMLElement::InsertNewChildElement | ( | -const char * | -name | ) | +const char * | name | ) |
0 Given an attribute name, IntAttribute() returns the value of the attribute interpreted as an integer. The default value will be returned if the attribute isn't present, or if there is an error. (For a method with error checking, see QueryIntAttribute()).
+Given an attribute name, IntAttribute() returns the value of the attribute interpreted as an integer. The default value will be returned if the attribute isn't present, or if there is an error. (For a method with error checking, see QueryIntAttribute()).
Given an attribute name, QueryAttribute() returns XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conversion can't be performed, or XML_NO_ATTRIBUTE if the attribute doesn't exist. It is overloaded for the primitive types, and is a generally more convenient replacement of QueryIntAttribute() and related functions.
+Given an attribute name, QueryAttribute() returns XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conversion can't be performed, or XML_NO_ATTRIBUTE if the attribute doesn't exist. It is overloaded for the primitive types, and is a generally more convenient replacement of QueryIntAttribute() and related functions.
If successful, the result of the conversion will be written to 'value'. If not successful, nothing will be written to 'value'. This allows you to provide default value:
int value = 10; QueryAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10
Given an attribute name, QueryIntAttribute() returns XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conversion can't be performed, or XML_NO_ATTRIBUTE if the attribute doesn't exist. If successful, the result of the conversion will be written to 'value'. If not successful, nothing will be written to 'value'. This allows you to provide default value:
+Given an attribute name, QueryIntAttribute() returns XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conversion can't be performed, or XML_NO_ATTRIBUTE if the attribute doesn't exist. If successful, the result of the conversion will be written to 'value'. If not successful, nothing will be written to 'value'. This allows you to provide default value:
int value = 10; QueryIntAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10
The QueryIntText() and similar functions provide a safe and easier way to get to the "value" of x and y.
+The QueryIntText() and similar functions provide a safe and easier way to get to the "value" of x and y.
int x = 0;
float y = 0; // types of x and y are contrived for example
const XMLElement* xElement = pointElement->FirstChildElement( "x" );
@@ -675,8 +651,8 @@ QueryIntAttribute( "foo", &value ); // if "foo" isn't found, value will
Convenience function for easy access to the text inside an element. Although easy and concise, SetText() is limited compared to creating an XMLText child and mutating it directly.
-If the first child of 'this' is a XMLText, SetText() sets its value to the given string, otherwise it will create a first child that is an XMLText.
+Convenience function for easy access to the text inside an element. Although easy and concise, SetText() is limited compared to creating an XMLText child and mutating it directly.
+If the first child of 'this' is a XMLText, SetText() sets its value to the given string, otherwise it will create a first child that is an XMLText.
This is a convenient method for setting the text of simple contained text:
<foo>This is text</foo>
fooElement->SetText( "Hullaballoo!" );
<foo>Hullaballoo!</foo>
Note that this function can be misleading. If the element foo was created from this XML:
<foo><b>This is text</b></foo>
then it will not change "This is text", but rather prefix it with a text element:
<foo>Hullaballoo!<b>This is text</b></foo>
For this XML:
<foo /> -
SetText() will generate
<foo>Hullaballoo!</foo> +
SetText() will generate
<foo>Hullaballoo!</foo>
| virtual XMLNode* tinyxml2::XMLElement::ShallowClone | +virtual XMLNode * tinyxml2::XMLElement::ShallowClone | ( | -XMLDocument * | -document | ) | +XMLDocument * | document | ) | const |
Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the 'document' is null, then the node returned will be allocated from the current Document. (this->GetDocument())
+Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the 'document' is null, then the node returned will be allocated from the current Document. (this->GetDocument())
Note: if called on a XMLDocument, this will return null.
-Implements tinyxml2::XMLNode.
+Implements tinyxml2::XMLNode.
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
This is the complete list of members for tinyxml2::XMLHandle, including all inherited members.
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
#include <tinyxml2.h>
+Public Member Functions
- | XMLHandle (XMLNode *node) | |
- | XMLHandle (XMLNode &node) | |
- | XMLHandle (const XMLHandle &ref) | |
-XMLHandle & | operator= (const XMLHandle &ref) | | Assignment. | |
-XMLHandle | FirstChild () |
+XMLHandle & | operator= (const XMLHandle &ref) | | Assignment. | | |
-XMLHandle | FirstChildElement (const char *name=0) | |
-XMLHandle | LastChild () | |
-XMLHandle | LastChildElement (const char *name=0) | |
-XMLHandle | PreviousSibling () | |
-XMLHandle | PreviousSiblingElement (const char *name=0) | |
-XMLHandle | NextSibling () | |
-XMLHandle | NextSiblingElement (const char *name=0) | |
-XMLNode * | ToNode () | | Safe cast to XMLNode. This can return null. | |
-XMLElement * | ToElement () | | Safe cast to XMLElement. This can return null. | |
-XMLText * | ToText () | | Safe cast to XMLText. This can return null. | |
-XMLUnknown * | ToUnknown () | | Safe cast to XMLUnknown. This can return null. | |
-XMLDeclaration * | ToDeclaration () | | Safe cast to XMLDeclaration. This can return null. | |
+XMLNode * | ToNode () | | Safe cast to XMLNode. This can return null. | |
+XMLElement * | ToElement () | | Safe cast to XMLElement. This can return null. | |
+XMLText * | ToText () | | Safe cast to XMLText. This can return null. | |
+XMLUnknown * | ToUnknown () | | Safe cast to XMLUnknown. This can return null. | |
+XMLDeclaration * | ToDeclaration () | | Safe cast to XMLDeclaration. This can return null. | | + | XMLHandle (XMLNode *node) | Create a handle from any node (at any depth of the tree.) This can be a null pointer. | + | XMLHandle (XMLNode &node) | Create a handle from a node. | + | XMLHandle (const XMLHandle &ref) | Copy constructor. | +XMLHandle | FirstChild () | Get the first child of this handle. | +XMLHandle | FirstChildElement (const char *name=0) | Get the first child element of this handle. | +XMLHandle | LastChild () | Get the last child of this handle. | +XMLHandle | LastChildElement (const char *name=0) | Get the last child element of this handle. | +XMLHandle | PreviousSibling () | Get the previous sibling of this handle. | +XMLHandle | PreviousSiblingElement (const char *name=0) | Get the previous sibling element of this handle. | +XMLHandle | NextSibling () | Get the next sibling of this handle. | +XMLHandle | NextSiblingElement (const char *name=0) | Get the next sibling element of this handle. | ||||||||||||||||||||||||||||||||||||||
A XMLHandle is a class that wraps a node pointer with null checks; this is an incredibly useful thing. Note that XMLHandle is not part of the TinyXML-2 DOM structure. It is a separate utility class.
@@ -184,7 +192,7 @@ if ( child2 )|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
This is the complete list of members for tinyxml2::XMLNode, including all inherited members.
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
+Public Member Functions
-const XMLDocument * | GetDocument () const | | Get the XMLDocument that owns this XMLNode. | |
-XMLDocument * | GetDocument () | | Get the XMLDocument that owns this XMLNode. | |
-virtual XMLElement * | ToElement () | | Safely cast to an Element, or null. | |
-virtual XMLText * | ToText () | | Safely cast to Text, or null. | |
-virtual XMLComment * | ToComment () | | Safely cast to a Comment, or null. | |
-virtual XMLDocument * | ToDocument () | | Safely cast to a Document, or null. | |
-virtual XMLDeclaration * | ToDeclaration () | | Safely cast to a Declaration, or null. | |
-virtual XMLUnknown * | ToUnknown () | | Safely cast to an Unknown, or null. | | const char * | Value () const | | void | SetValue (const char *val, bool staticMem=false) |
+const XMLDocument * | GetDocument () const | | Get the XMLDocument that owns this XMLNode. | |
+XMLDocument * | GetDocument () | | Get the XMLDocument that owns this XMLNode. | |
+virtual XMLElement * | ToElement () | | Safely cast to an Element, or null. | |
+virtual XMLText * | ToText () | | Safely cast to Text, or null. | |
+virtual XMLComment * | ToComment () | | Safely cast to a Comment, or null. | |
+virtual XMLDocument * | ToDocument () | | Safely cast to a Document, or null. | |
+virtual XMLDeclaration * | ToDeclaration () | | Safely cast to a Declaration, or null. | |
+virtual XMLUnknown * | ToUnknown () | | Safely cast to an Unknown, or null. | | const char * | Value () const | | |
-int | GetLineNum () const | |
-const XMLNode * | Parent () const | | Get the parent of this node on the DOM. | |
-bool | NoChildren () const |
+const XMLNode * | Parent () const | | Get the parent of this node on the DOM. | | |
-const XMLNode * | FirstChild () const | | Get the first child node, or null if none exists. | | const XMLElement * | FirstChildElement (const char *name=0) const | |
-const XMLNode * | LastChild () const | | Get the last child node, or null if none exists. | | const XMLElement * | LastChildElement (const char *name=0) const | |
-const XMLNode * | PreviousSibling () const | | Get the previous (left) sibling node of this node. | |
-const XMLElement * | PreviousSiblingElement (const char *name=0) const | | Get the previous (left) sibling element of this node, with an optionally supplied name. | |
-const XMLNode * | NextSibling () const | | Get the next (right) sibling node of this node. | |
-const XMLElement * | NextSiblingElement (const char *name=0) const | | Get the next (right) sibling element of this node, with an optionally supplied name. | | XMLNode * | InsertEndChild (XMLNode *addThis) | | XMLNode * | InsertFirstChild (XMLNode *addThis) | | XMLNode * | InsertAfterChild (XMLNode *afterThis, XMLNode *addThis) | | void | DeleteChildren () |
+const XMLNode * | FirstChild () const | | Get the first child node, or null if none exists. | | const XMLElement * | FirstChildElement (const char *name=0) const | |
+const XMLNode * | LastChild () const | | Get the last child node, or null if none exists. | | const XMLElement * | LastChildElement (const char *name=0) const | |
+const XMLNode * | PreviousSibling () const | | Get the previous (left) sibling node of this node. | |
+const XMLElement * | PreviousSiblingElement (const char *name=0) const | | Get the previous (left) sibling element of this node, with an optionally supplied name. | |
+const XMLNode * | NextSibling () const | | Get the next (right) sibling node of this node. | |
+const XMLElement * | NextSiblingElement (const char *name=0) const | | Get the next (right) sibling element of this node, with an optionally supplied name. | | XMLNode * | InsertEndChild (XMLNode *addThis) | | XMLNode * | InsertFirstChild (XMLNode *addThis) | | XMLNode * | InsertAfterChild (XMLNode *afterThis, XMLNode *addThis) | | | void | DeleteChild (XMLNode *node) | | virtual XMLNode * | ShallowClone (XMLDocument *document) const =0 | | XMLNode * | DeepClone (XMLDocument *target) const | | virtual bool | ShallowEqual (const XMLNode *compare) const =0 | virtual XMLNode * | ShallowClone (XMLDocument *document) const =0 | | XMLNode * | DeepClone (XMLDocument *target) const | | | virtual bool | Accept (XMLVisitor *visitor) const =0 | | void | SetUserData (void *userData) | | void * | GetUserData () const | | void * | GetUserData () const | | void | SetValue (const char *val, bool staticMem=false) | +int | GetLineNum () const | Gets the line number the node is in, if the document was parsed from a file. | +bool | NoChildren () const | Returns true if this node has no children. | void | DeleteChildren () | void | DeleteChild (XMLNode *node) | virtual bool | ShallowEqual (const XMLNode *compare) const =0 | virtual bool | Accept (XMLVisitor *visitor) const =0 | void | SetUserData (void *userData) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
XMLNode is a base class for every object that is in the XML Document Object Model (DOM), except XMLAttributes. Nodes have siblings, a parent, and children which can be navigated. A node is always in a XMLDocument. The type of a XMLNode can be queried, and it can be cast to its more defined type.
@@ -204,8 +212,8 @@ An Element can contain: Element (container or leaf) Attributes (not on tree) Comment (leaf) Unknown (leaf)Which are both good references for "visiting".
-An example of using Accept():
XMLPrinter printer; +An example of using Accept():
XMLPrinter printer; tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr();-Implemented in tinyxml2::XMLDocument, tinyxml2::XMLElement, tinyxml2::XMLUnknown, tinyxml2::XMLDeclaration, tinyxml2::XMLComment, and tinyxml2::XMLText.
+Implemented in tinyxml2::XMLText, tinyxml2::XMLComment, tinyxml2::XMLDeclaration, tinyxml2::XMLUnknown, tinyxml2::XMLElement, and tinyxml2::XMLDocument.
| XMLNode* tinyxml2::XMLNode::DeepClone | +XMLNode * tinyxml2::XMLNode::DeepClone | ( | -XMLDocument * | -target | ) | +XMLDocument * | target | ) | const |
| const XMLElement* tinyxml2::XMLNode::FirstChildElement | +const XMLElement * tinyxml2::XMLNode::FirstChildElement | ( | -const char * | -name = 0 | ) | +const char * | name = 0 | ) | const |
| void* tinyxml2::XMLNode::GetUserData | +void * tinyxml2::XMLNode::GetUserData | ( | -) | +) | const |
| XMLNode* tinyxml2::XMLNode::InsertAfterChild | +XMLNode * tinyxml2::XMLNode::InsertAfterChild | ( | -XMLNode * | -afterThis, | +XMLNode * | afterThis, |
| - | XMLNode * | -addThis | -||||
| - | ) | -+ | XMLNode * | addThis ) |
| const XMLElement* tinyxml2::XMLNode::LastChildElement | +const XMLElement * tinyxml2::XMLNode::LastChildElement | ( | -const char * | -name = 0 | ) | +const char * | name = 0 | ) | const |
false | virtual XMLNode* tinyxml2::XMLNode::ShallowClone | +virtual XMLNode * tinyxml2::XMLNode::ShallowClone | ( | -XMLDocument * | -document | ) | +XMLDocument * | document | ) | const |
Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the 'document' is null, then the node returned will be allocated from the current Document. (this->GetDocument())
+Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the 'document' is null, then the node returned will be allocated from the current Document. (this->GetDocument())
Note: if called on a XMLDocument, this will return null.
-Implemented in tinyxml2::XMLElement, tinyxml2::XMLUnknown, tinyxml2::XMLDeclaration, tinyxml2::XMLComment, tinyxml2::XMLText, and tinyxml2::XMLDocument.
+Implemented in tinyxml2::XMLDocument, tinyxml2::XMLText, tinyxml2::XMLComment, tinyxml2::XMLDeclaration, tinyxml2::XMLUnknown, and tinyxml2::XMLElement.
Test if 2 nodes are the same, but don't test children. The 2 nodes do not need to be in the same Document.
Note: if called on a XMLDocument, this will return false.
-Implemented in tinyxml2::XMLElement, tinyxml2::XMLUnknown, tinyxml2::XMLDeclaration, tinyxml2::XMLComment, tinyxml2::XMLText, and tinyxml2::XMLDocument.
+Implemented in tinyxml2::XMLDocument, tinyxml2::XMLText, tinyxml2::XMLComment, tinyxml2::XMLDeclaration, tinyxml2::XMLUnknown, and tinyxml2::XMLElement.
| const char* tinyxml2::XMLNode::Value | +const char * tinyxml2::XMLNode::Value | ( | -) | +) | const |
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
This is the complete list of members for tinyxml2::XMLPrinter, including all inherited members.
| ClearBuffer(bool resetToFirstElement=true) | tinyxml2::XMLPrinter | inline |
| CloseElement(bool compactMode=false) | tinyxml2::XMLPrinter | virtual |
| CStr() const | tinyxml2::XMLPrinter | inline |
| CStrSize() const | tinyxml2::XMLPrinter | inline |
| CloseElement(bool compactMode=false) | tinyxml2::XMLPrinter | virtual |
| CStr() const | tinyxml2::XMLPrinter | inline |
| CStrSize() const | tinyxml2::XMLPrinter | inline |
| OpenElement(const char *name, bool compactMode=false) | tinyxml2::XMLPrinter | |
| PrintSpace(int depth) | tinyxml2::XMLPrinter | protectedvirtual |
| PrintSpace(int depth) | tinyxml2::XMLPrinter | protectedvirtual |
| PushAttribute(const char *name, const char *value) | tinyxml2::XMLPrinter | |
| PushComment(const char *comment) | tinyxml2::XMLPrinter | |
| PushComment(const char *comment) | tinyxml2::XMLPrinter | |
| PushHeader(bool writeBOM, bool writeDeclaration) | tinyxml2::XMLPrinter | |
| PushText(const char *text, bool cdata=false) | tinyxml2::XMLPrinter | |
| PushText(const char *text, bool cdata=false) | tinyxml2::XMLPrinter | |
| PushText(int value) | tinyxml2::XMLPrinter | |
| PushText(unsigned value) | tinyxml2::XMLPrinter | |
| PushText(unsigned value) | tinyxml2::XMLPrinter | |
| PushText(int64_t value) | tinyxml2::XMLPrinter | |
| PushText(uint64_t value) | tinyxml2::XMLPrinter | |
| PushText(uint64_t value) | tinyxml2::XMLPrinter | |
| PushText(bool value) | tinyxml2::XMLPrinter | |
| PushText(float value) | tinyxml2::XMLPrinter | |
| PushText(float value) | tinyxml2::XMLPrinter | |
| PushText(double value) | tinyxml2::XMLPrinter | |
| Visit(const XMLText &text) | tinyxml2::XMLPrinter | virtual |
| Visit(const XMLComment &comment) | tinyxml2::XMLPrinter | virtual |
| Visit(const XMLDeclaration &declaration) | tinyxml2::XMLPrinter | virtual |
| Visit(const XMLUnknown &unknown) | tinyxml2::XMLPrinter | virtual |
| VisitEnter(const XMLDocument &) | tinyxml2::XMLPrinter | virtual |
| VisitEnter(const XMLElement &element, const XMLAttribute *attribute) | tinyxml2::XMLPrinter | virtual |
| VisitExit(const XMLDocument &) | tinyxml2::XMLPrinter | inlinevirtual |
| VisitExit(const XMLElement &element) | tinyxml2::XMLPrinter | virtual |
| XMLPrinter(FILE *file=0, bool compact=false, int depth=0) | tinyxml2::XMLPrinter | |
| Visit(const XMLText &text) override | tinyxml2::XMLPrinter | virtual |
| Visit(const XMLComment &comment) override | tinyxml2::XMLPrinter | virtual |
| Visit(const XMLDeclaration &declaration) override | tinyxml2::XMLPrinter | virtual |
| Visit(const XMLUnknown &unknown) override | tinyxml2::XMLPrinter | virtual |
| VisitEnter(const XMLDocument &) override | tinyxml2::XMLPrinter | virtual |
| VisitEnter(const XMLElement &element, const XMLAttribute *attribute) override | tinyxml2::XMLPrinter | virtual |
| VisitExit(const XMLDocument &) override | tinyxml2::XMLPrinter | inlinevirtual |
| VisitExit(const XMLElement &element) override | tinyxml2::XMLPrinter | virtual |
| XMLPrinter(FILE *file=0, bool compact=false, int depth=0) | tinyxml2::XMLPrinter |
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
+Public Member Functions | XMLPrinter (FILE *file=0, bool compact=false, int depth=0) | | void | PushHeader (bool writeBOM, bool writeDeclaration) | | void | OpenElement (const char *name, bool compactMode=false) | |
-void | PushAttribute (const char *name, const char *value) | |
-virtual void | CloseElement (bool compactMode=false) | |
-void | PushText (const char *text, bool cdata=false) | |
-void | PushText (int value) | |
-void | PushText (unsigned value) | |
-void | PushText (int64_t value) | |
-void | PushText (uint64_t value) | |
-void | PushText (bool value) | |
-void | PushText (float value) | |
-void | PushText (double value) | |
-void | PushComment (const char *comment) | |
-virtual bool | VisitEnter (const XMLDocument &) | | Visit a document. | |
-virtual bool | VisitExit (const XMLDocument &) | | Visit a document. | |
-virtual bool | VisitEnter (const XMLElement &element, const XMLAttribute *attribute) | | Visit an element. | |
-virtual bool | VisitExit (const XMLElement &element) | | Visit an element. | |
-virtual bool | Visit (const XMLText &text) | | Visit a text node. | |
-virtual bool | Visit (const XMLComment &comment) | | Visit a comment node. | |
-virtual bool | Visit (const XMLDeclaration &declaration) | | Visit a declaration. | |
-virtual bool | Visit (const XMLUnknown &unknown) | | Visit an unknown node. | | const char * | CStr () const | | int | CStrSize () const |
+virtual bool | VisitEnter (const XMLDocument &) override | | Visit a document. | |
+virtual bool | VisitExit (const XMLDocument &) override | | Visit a document. | |
+virtual bool | VisitEnter (const XMLElement &element, const XMLAttribute *attribute) override | | Visit an element. | |
+virtual bool | VisitExit (const XMLElement &element) override | | Visit an element. | |
+virtual bool | Visit (const XMLText &text) override | | Visit a text node. | |
+virtual bool | Visit (const XMLComment &comment) override | | Visit a comment node. | |
+virtual bool | Visit (const XMLDeclaration &declaration) override | | Visit a declaration. | |
+virtual bool | Visit (const XMLUnknown &unknown) override | | Visit an unknown node. | | const char * | CStr () const | | | void | ClearBuffer (bool resetToFirstElement=true) | | XMLPrinter (FILE *file=0, bool compact=false, int depth=0) | void | PushHeader (bool writeBOM, bool writeDeclaration) | void | OpenElement (const char *name, bool compactMode=false) | +void | PushAttribute (const char *name, const char *value) | If streaming, add an attribute to an open element. | +virtual void | CloseElement (bool compactMode=false) | If streaming, close the Element. | +void | PushText (const char *text, bool cdata=false) | Add a text node. | +void | PushText (int value) | Add a text node from an integer. | +void | PushText (unsigned value) | Add a text node from an unsigned. | +void | PushText (int64_t value) | Add a text node from a signed 64bit integer. | +void | PushText (uint64_t value) | Add a text node from an unsigned 64bit integer. | +void | PushText (bool value) | Add a text node from a bool. | +void | PushText (float value) | Add a text node from a float. | +void | PushText (double value) | Add a text node from a double. | +void | PushComment (const char *comment) | Add a comment. | int | CStrSize () const | void | ClearBuffer (bool resetToFirstElement=true) | ||||||||||||||||||||||||||||||||||||||||||||||||||
+Protected Member Functionsvirtual void | PrintSpace (int depth) | | virtual void | PrintSpace (int depth) | |||||
0, false, 0 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.
+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.
true| const char* tinyxml2::XMLPrinter::CStr | +const char * tinyxml2::XMLPrinter::CStr | ( | -) | +) | const |
false If streaming, start writing an element. The element must be closed with CloseElement()
+If streaming, start writing an element. The element must be closed with CloseElement()
Prints out the space before an element. You may override to change the space and tabs used. A PrintSpace() override should call Print().
+Prints out the space before an element. You may override to change the space and tabs used. A PrintSpace() override should call Print().
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
This is the complete list of members for tinyxml2::XMLText, including all inherited members.
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
+Public Member Functionsvirtual bool | Accept (XMLVisitor *visitor) const | |
-virtual XMLText * | ToText () | | Safely cast to Text, or null. | |
-void | SetCData (bool isCData) | virtual bool | Accept (XMLVisitor *visitor) const override | |
+virtual XMLText * | ToText () override | | Safely cast to Text, or null. | | |
-bool | CData () const | | virtual XMLNode * | ShallowClone (XMLDocument *document) const | | virtual bool | ShallowEqual (const XMLNode *compare) const | | Public Member Functions inherited from tinyxml2::XMLNode
-const XMLDocument * | GetDocument () const | | Get the XMLDocument that owns this XMLNode. | |
-XMLDocument * | GetDocument () | | Get the XMLDocument that owns this XMLNode. | |
-virtual XMLElement * | ToElement () | | Safely cast to an Element, or null. | |
-virtual XMLComment * | ToComment () | | Safely cast to a Comment, or null. | |
-virtual XMLDocument * | ToDocument () | | Safely cast to a Document, or null. | |
-virtual XMLDeclaration * | ToDeclaration () | | Safely cast to a Declaration, or null. | |
-virtual XMLUnknown * | ToUnknown () | | Safely cast to an Unknown, or null. | | const char * | Value () const | | void | SetValue (const char *val, bool staticMem=false) | virtual XMLNode * | ShallowClone (XMLDocument *document) const override | | virtual bool | ShallowEqual (const XMLNode *compare) const override | | Public Member Functions inherited from tinyxml2::XMLNode
+const XMLDocument * | GetDocument () const | | Get the XMLDocument that owns this XMLNode. | |
+XMLDocument * | GetDocument () | | Get the XMLDocument that owns this XMLNode. | |
+virtual XMLElement * | ToElement () | | Safely cast to an Element, or null. | |
+virtual XMLComment * | ToComment () | | Safely cast to a Comment, or null. | |
+virtual XMLDocument * | ToDocument () | | Safely cast to a Document, or null. | |
+virtual XMLDeclaration * | ToDeclaration () | | Safely cast to a Declaration, or null. | |
+virtual XMLUnknown * | ToUnknown () | | Safely cast to an Unknown, or null. | | const char * | Value () const | | |
-int | GetLineNum () const | |
-const XMLNode * | Parent () const | | Get the parent of this node on the DOM. | |
-bool | NoChildren () const |
+const XMLNode * | Parent () const | | Get the parent of this node on the DOM. | | |
-const XMLNode * | FirstChild () const | | Get the first child node, or null if none exists. | | const XMLElement * | FirstChildElement (const char *name=0) const | |
-const XMLNode * | LastChild () const | | Get the last child node, or null if none exists. | | const XMLElement * | LastChildElement (const char *name=0) const | |
-const XMLNode * | PreviousSibling () const | | Get the previous (left) sibling node of this node. | |
-const XMLElement * | PreviousSiblingElement (const char *name=0) const | | Get the previous (left) sibling element of this node, with an optionally supplied name. | |
-const XMLNode * | NextSibling () const | | Get the next (right) sibling node of this node. | |
-const XMLElement * | NextSiblingElement (const char *name=0) const | | Get the next (right) sibling element of this node, with an optionally supplied name. | | XMLNode * | InsertEndChild (XMLNode *addThis) | | XMLNode * | InsertFirstChild (XMLNode *addThis) | | XMLNode * | InsertAfterChild (XMLNode *afterThis, XMLNode *addThis) | | void | DeleteChildren () |
+const XMLNode * | FirstChild () const | | Get the first child node, or null if none exists. | | const XMLElement * | FirstChildElement (const char *name=0) const | |
+const XMLNode * | LastChild () const | | Get the last child node, or null if none exists. | | const XMLElement * | LastChildElement (const char *name=0) const | |
+const XMLNode * | PreviousSibling () const | | Get the previous (left) sibling node of this node. | |
+const XMLElement * | PreviousSiblingElement (const char *name=0) const | | Get the previous (left) sibling element of this node, with an optionally supplied name. | |
+const XMLNode * | NextSibling () const | | Get the next (right) sibling node of this node. | |
+const XMLElement * | NextSiblingElement (const char *name=0) const | | Get the next (right) sibling element of this node, with an optionally supplied name. | | XMLNode * | InsertEndChild (XMLNode *addThis) | | XMLNode * | InsertFirstChild (XMLNode *addThis) | | XMLNode * | InsertAfterChild (XMLNode *afterThis, XMLNode *addThis) | | | void | DeleteChild (XMLNode *node) | | XMLNode * | DeepClone (XMLDocument *target) const | | void | SetUserData (void *userData) | XMLNode * | DeepClone (XMLDocument *target) const | | | void * | GetUserData () const | | void * | GetUserData () const | | +void | SetCData (bool isCData) | Declare whether this should be CDATA or standard text. | +bool | CData () const | Returns true if this is a CDATA text element. | void | SetValue (const char *val, bool staticMem=false) | +int | GetLineNum () const | Gets the line number the node is in, if the document was parsed from a file. | +bool | NoChildren () const | Returns true if this node has no children. | void | DeleteChildren () | void | DeleteChild (XMLNode *node) | void | SetUserData (void *userData) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
XML text.
Note that a text node can have child element nodes, for example:
<root>This is <b>bold</b></root> -
A text node can have 2 ways to output the next. "normal" output and CDATA. It will default to the mode it was parsed from the XML file and you generally want to leave it alone, but you can change the output mode with SetCData() and query it with CData().
+A text node can have 2 ways to output the next. "normal" output and CDATA. It will default to the mode it was parsed from the XML file and you generally want to leave it alone, but you can change the output mode with SetCData() and query it with CData().
Which are both good references for "visiting".
-An example of using Accept():
XMLPrinter printer; +An example of using Accept():
XMLPrinter printer; tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr();@@ -239,8 +246,8 @@ const char* xmlcstr = printer.CStr();
| virtual XMLNode* tinyxml2::XMLText::ShallowClone | +virtual XMLNode * tinyxml2::XMLText::ShallowClone | ( | -XMLDocument * | -document | ) | +XMLDocument * | document | ) | const |
Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the 'document' is null, then the node returned will be allocated from the current Document. (this->GetDocument())
+Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the 'document' is null, then the node returned will be allocated from the current Document. (this->GetDocument())
Note: if called on a XMLDocument, this will return null.
-Implements tinyxml2::XMLNode.
+Implements tinyxml2::XMLNode.
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
This is the complete list of members for tinyxml2::XMLUnknown, including all inherited members.
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
+Public Member Functions
-virtual XMLUnknown * | ToUnknown () | | Safely cast to an Unknown, or null. | | virtual bool | Accept (XMLVisitor *visitor) const | | virtual XMLNode * | ShallowClone (XMLDocument *document) const | | virtual bool | ShallowEqual (const XMLNode *compare) const | | Public Member Functions inherited from tinyxml2::XMLNode
-const XMLDocument * | GetDocument () const | | Get the XMLDocument that owns this XMLNode. | |
-XMLDocument * | GetDocument () | | Get the XMLDocument that owns this XMLNode. | |
-virtual XMLElement * | ToElement () | | Safely cast to an Element, or null. | |
-virtual XMLText * | ToText () | | Safely cast to Text, or null. | |
-virtual XMLComment * | ToComment () | | Safely cast to a Comment, or null. | |
-virtual XMLDocument * | ToDocument () | | Safely cast to a Document, or null. | |
-virtual XMLDeclaration * | ToDeclaration () | | Safely cast to a Declaration, or null. | | const char * | Value () const | | void | SetValue (const char *val, bool staticMem=false) |
+virtual XMLUnknown * | ToUnknown () override | | Safely cast to an Unknown, or null. | | virtual bool | Accept (XMLVisitor *visitor) const override | | virtual XMLNode * | ShallowClone (XMLDocument *document) const override | | virtual bool | ShallowEqual (const XMLNode *compare) const override | | Public Member Functions inherited from tinyxml2::XMLNode
+const XMLDocument * | GetDocument () const | | Get the XMLDocument that owns this XMLNode. | |
+XMLDocument * | GetDocument () | | Get the XMLDocument that owns this XMLNode. | |
+virtual XMLElement * | ToElement () | | Safely cast to an Element, or null. | |
+virtual XMLText * | ToText () | | Safely cast to Text, or null. | |
+virtual XMLComment * | ToComment () | | Safely cast to a Comment, or null. | |
+virtual XMLDocument * | ToDocument () | | Safely cast to a Document, or null. | |
+virtual XMLDeclaration * | ToDeclaration () | | Safely cast to a Declaration, or null. | | const char * | Value () const | | |
-int | GetLineNum () const | |
-const XMLNode * | Parent () const | | Get the parent of this node on the DOM. | |
-bool | NoChildren () const |
+const XMLNode * | Parent () const | | Get the parent of this node on the DOM. | | |
-const XMLNode * | FirstChild () const | | Get the first child node, or null if none exists. | | const XMLElement * | FirstChildElement (const char *name=0) const | |
-const XMLNode * | LastChild () const | | Get the last child node, or null if none exists. | | const XMLElement * | LastChildElement (const char *name=0) const | |
-const XMLNode * | PreviousSibling () const | | Get the previous (left) sibling node of this node. | |
-const XMLElement * | PreviousSiblingElement (const char *name=0) const | | Get the previous (left) sibling element of this node, with an optionally supplied name. | |
-const XMLNode * | NextSibling () const | | Get the next (right) sibling node of this node. | |
-const XMLElement * | NextSiblingElement (const char *name=0) const | | Get the next (right) sibling element of this node, with an optionally supplied name. | | XMLNode * | InsertEndChild (XMLNode *addThis) | | XMLNode * | InsertFirstChild (XMLNode *addThis) | | XMLNode * | InsertAfterChild (XMLNode *afterThis, XMLNode *addThis) | | void | DeleteChildren () |
+const XMLNode * | FirstChild () const | | Get the first child node, or null if none exists. | | const XMLElement * | FirstChildElement (const char *name=0) const | |
+const XMLNode * | LastChild () const | | Get the last child node, or null if none exists. | | const XMLElement * | LastChildElement (const char *name=0) const | |
+const XMLNode * | PreviousSibling () const | | Get the previous (left) sibling node of this node. | |
+const XMLElement * | PreviousSiblingElement (const char *name=0) const | | Get the previous (left) sibling element of this node, with an optionally supplied name. | |
+const XMLNode * | NextSibling () const | | Get the next (right) sibling node of this node. | |
+const XMLElement * | NextSiblingElement (const char *name=0) const | | Get the next (right) sibling element of this node, with an optionally supplied name. | | XMLNode * | InsertEndChild (XMLNode *addThis) | | XMLNode * | InsertFirstChild (XMLNode *addThis) | | XMLNode * | InsertAfterChild (XMLNode *afterThis, XMLNode *addThis) | | | void | DeleteChild (XMLNode *node) | | XMLNode * | DeepClone (XMLDocument *target) const | | void | SetUserData (void *userData) | XMLNode * | DeepClone (XMLDocument *target) const | | | void * | GetUserData () const | | void * | GetUserData () const | | void | SetValue (const char *val, bool staticMem=false) | +int | GetLineNum () const | Gets the line number the node is in, if the document was parsed from a file. | +bool | NoChildren () const | Returns true if this node has no children. | void | DeleteChildren () | void | DeleteChild (XMLNode *node) | void | SetUserData (void *userData) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Any tag that TinyXML-2 doesn't recognize is saved as an unknown. It is a tag of text, but should not be modified. It will be written back to the XML, unchanged, when the file is saved.
DTD tags get thrown into XMLUnknowns.
Which are both good references for "visiting".
-An example of using Accept():
XMLPrinter printer; +An example of using Accept():
XMLPrinter printer; tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr();@@ -230,8 +237,8 @@ const char* xmlcstr = printer.CStr();
| virtual XMLNode* tinyxml2::XMLUnknown::ShallowClone | +virtual XMLNode * tinyxml2::XMLUnknown::ShallowClone | ( | -XMLDocument * | -document | ) | +XMLDocument * | document | ) | const |
Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the 'document' is null, then the node returned will be allocated from the current Document. (this->GetDocument())
+Make a copy of this node, but not its children. You may pass in a Document pointer that will be the owner of the new Node. If the 'document' is null, then the node returned will be allocated from the current Document. (this->GetDocument())
Note: if called on a XMLDocument, this will return null.
-Implements tinyxml2::XMLNode.
+Implements tinyxml2::XMLNode.
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
This is the complete list of members for tinyxml2::XMLVisitor, including all inherited members.
| Visit(const XMLDeclaration &) | tinyxml2::XMLVisitor | inlinevirtual |
| Visit(const XMLText &) | tinyxml2::XMLVisitor | inlinevirtual |
| Visit(const XMLText &) | tinyxml2::XMLVisitor | inlinevirtual |
| Visit(const XMLComment &) | tinyxml2::XMLVisitor | inlinevirtual |
| Visit(const XMLUnknown &) | tinyxml2::XMLVisitor | inlinevirtual |
| Visit(const XMLUnknown &) | tinyxml2::XMLVisitor | inlinevirtual |
| VisitEnter(const XMLDocument &) | tinyxml2::XMLVisitor | inlinevirtual |
| VisitEnter(const XMLElement &, const XMLAttribute *) | tinyxml2::XMLVisitor | inlinevirtual |
| VisitEnter(const XMLElement &, const XMLAttribute *) | tinyxml2::XMLVisitor | inlinevirtual |
| VisitExit(const XMLDocument &) | tinyxml2::XMLVisitor | inlinevirtual |
| VisitExit(const XMLElement &) | tinyxml2::XMLVisitor | inlinevirtual |
| VisitExit(const XMLElement &) | tinyxml2::XMLVisitor | inlinevirtual |
|
- TinyXML-2
- 9.0.0
+
+ |
TinyXML-2 10.0.0
|
+Public Member Functions
-virtual bool | VisitEnter (const XMLDocument &) | |
-virtual bool | VisitExit (const XMLDocument &) | |
-virtual bool | VisitEnter (const XMLElement &, const XMLAttribute *) | |
-virtual bool | VisitExit (const XMLElement &) | |
-virtual bool | Visit (const XMLDeclaration &) | |
-virtual bool | Visit (const XMLText &) | |
-virtual bool | Visit (const XMLComment &) | |
-virtual bool | Visit (const XMLUnknown &) | | +virtual bool | VisitEnter (const XMLDocument &) | Visit a document. | +virtual bool | VisitExit (const XMLDocument &) | Visit a document. | +virtual bool | VisitEnter (const XMLElement &, const XMLAttribute *) | Visit an element. | +virtual bool | VisitExit (const XMLElement &) | Visit an element. | +virtual bool | Visit (const XMLDeclaration &) | Visit a declaration. | +virtual bool | Visit (const XMLText &) | Visit a text node. | +virtual bool | Visit (const XMLComment &) | Visit a comment node. | +virtual bool | Visit (const XMLUnknown &) | Visit an unknown node. | ||||||||||||||||||||
Implements the interface to the "Visitor pattern" (see the Accept() method.) If you call the Accept() method, it requires being passed a XMLVisitor class to handle callbacks. For nodes that contain other nodes (Document, Element) you will get called with a VisitEnter/VisitExit pair. Nodes that are always leafs are simply called with Visit().
+Implements the interface to the "Visitor pattern" (see the Accept() method.) If you call the Accept() method, it requires being passed a XMLVisitor class to handle callbacks. For nodes that contain other nodes (Document, Element) you will get called with a VisitEnter/VisitExit pair. Nodes that are always leafs are simply called with Visit().
If you return 'true' from a Visit method, recursive parsing will continue. If you return false, no children of this node or its siblings will be visited.
All flavors of Visit methods have a default implementation that returns 'true' (continue visiting). You need to only override methods that are interesting to you.
Generally Accept() is called on the XMLDocument, although all nodes support visiting.
@@ -133,7 +141,7 @@ virtual bool