diff --git a/vendor/github.com/leethomason/tinyxml2/docs/_example-1.html b/vendor/github.com/leethomason/tinyxml2/docs/_example-1.html deleted file mode 100644 index 7eb126b..0000000 --- a/vendor/github.com/leethomason/tinyxml2/docs/_example-1.html +++ /dev/null @@ -1,75 +0,0 @@ - - -
- - - - -
- TinyXML-2
- 5.0.1
-
- |
-
- TinyXML-2
- 5.0.1
-
- |
-
- TinyXML-2
- 5.0.1
-
- |
-
(The XML is an excerpt from "dream.xml").
-The structure of the XML file is:
-For this example, we want to print out the title of the play. The text of the title (what we want) is child of the "TITLE" element which is a child of the "PLAY" element.
-We want to skip the declaration and dtd, so the method FirstChildElement() is a good choice. The FirstChildElement() of the Document is the "PLAY" Element, the FirstChildElement() of the "PLAY" Element is the "TITLE" Element.
-We can then use the convenience function GetText() to get the title of the play.
-Text is just another Node in the XML DOM. And in fact you should be a little cautious with it, as text nodes can contain elements.
-Consider: A Midsummer Night's <b>Dream</b> -
It is more correct to actually query the Text Node if in doubt:
-Noting that here we use FirstChild() since we are looking for XMLText, not an element, and ToText() is a cast from a Node to a XMLText.
-
- TinyXML-2
- 5.0.1
-
- |
-
There are fundamentally 2 ways of writing a key-value pair into an XML file. (Something that's always annoyed me about XML.) Either by using attributes, or by writing the key name into an element and the value into the text node wrapped by the element. Both approaches are illustrated in this example, which shows two ways to encode the value "2" into the key "v":
-TinyXML-2 has accessors for both approaches.
-When using an attribute, you navigate to the XMLElement with that attribute and use the QueryIntAttribute() group of methods. (Also QueryFloatAttribute(), etc.)
-When using the text approach, you need to navigate down one more step to the XMLElement that contains the text. Note the extra FirstChildElement( "v" ) in the code below. The value of the text can then be safely queried with the QueryIntText() group of methods. (Also QueryFloatText(), etc.)
-
- TinyXML-2
- 5.0.1
-
- |
-
▼Ntinyxml2 | |
CXMLAttribute | |
CXMLComment | |
CXMLConstHandle | |
CXMLDeclaration | |
CXMLDocument | |
CXMLElement | |
CXMLHandle | |
CXMLNode | |
CXMLPrinter | |
CXMLText | |
CXMLUnknown | |
CXMLVisitor |
- TinyXML-2
- 5.0.1
-
- |
-
| XMLComment (tinyxml2) | XMLDocument (tinyxml2) | XMLNode (tinyxml2) | XMLUnknown (tinyxml2) | |
XMLConstHandle (tinyxml2) | XMLElement (tinyxml2) | XMLPrinter (tinyxml2) | XMLVisitor (tinyxml2) | ||
XMLAttribute (tinyxml2) | XMLDeclaration (tinyxml2) | XMLHandle (tinyxml2) | XMLText (tinyxml2) | ||
- TinyXML-2
- 5.0.1
-
- |
-
This is the complete list of members for tinyxml2::XMLAttribute, including all inherited members.
-
- TinyXML-2
- 5.0.1
-
- |
-
#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 |
Gets the line number the attribute is in, if the document was parsed from a file. | |
-const XMLAttribute * | Next () const |
The next attribute in the list. | |
int | IntValue () const |
-unsigned | UnsignedValue () const |
Query as an unsigned integer. See IntValue() | |
-bool | BoolValue () const |
Query as a boolean. See IntValue() | |
-double | DoubleValue () const |
Query as a double. See IntValue() | |
-float | FloatValue () const |
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 | 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 (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.
-
-
|
- -inline | -
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.
- -XMLError tinyxml2::XMLAttribute::QueryIntValue | -( | -int * | -value | ) | -const | -
QueryIntValue interprets the attribute as an integer, and returns the value in the provided parameter. The function will return XML_SUCCESS on success, and XML_WRONG_ATTRIBUTE_TYPE if the conversion is not successful.
- -
- TinyXML-2
- 5.0.1
-
- |
-
This is the complete list of members for tinyxml2::XMLComment, including all inherited members.
-
- TinyXML-2
- 5.0.1
-
- |
-
#include <tinyxml2.h>
-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) |
-int | GetLineNum () const |
Gets the line number the node is in, if the document was parsed from a file. | |
-const XMLNode * | Parent () const |
Get the parent of this node on the DOM. | |
-bool | NoChildren () const |
Returns true if this node has no children. | |
-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 () |
void | DeleteChild (XMLNode *node) |
XMLNode * | DeepClone (XMLDocument *target) const |
void | SetUserData (void *userData) |
void * | GetUserData () const |
An XML Comment.
-
-
|
- -virtual | -
Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the XML tree will be conditionally visited and the host will be called back via the XMLVisitor interface.
-This is essentially a SAX interface for TinyXML-2. (Note however it doesn't re-parse the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this interface versus any other.)
-The interface has been based on ideas from:
- -Which are both good references for "visiting".
-An example of using Accept():
XMLPrinter printer; -tinyxmlDoc.Accept( &printer ); -const char* xmlcstr = printer.CStr(); --
Implements tinyxml2::XMLNode.
- -
-
|
- -virtual | -
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.
- -
-
|
- -virtual | -
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.
- -Implements tinyxml2::XMLNode.
- -
- TinyXML-2
- 5.0.1
-
- |
-
This is the complete list of members for tinyxml2::XMLConstHandle, including all inherited members.
-
- TinyXML-2
- 5.0.1
-
- |
-
#include <tinyxml2.h>
A variant of the XMLHandle class for working with const XMLNodes and Documents. It is the same in all regards, except for the 'const' qualifiers. See XMLHandle for API.
-
- TinyXML-2
- 5.0.1
-
- |
-
This is the complete list of members for tinyxml2::XMLDeclaration, including all inherited members.
-
- TinyXML-2
- 5.0.1
-
- |
-
#include <tinyxml2.h>
-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) |
-int | GetLineNum () const |
Gets the line number the node is in, if the document was parsed from a file. | |
-const XMLNode * | Parent () const |
Get the parent of this node on the DOM. | |
-bool | NoChildren () const |
Returns true if this node has no children. | |
-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 () |
void | DeleteChild (XMLNode *node) |
XMLNode * | DeepClone (XMLDocument *target) const |
void | SetUserData (void *userData) |
void * | GetUserData () const |
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.
-
-
|
- -virtual | -
Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the XML tree will be conditionally visited and the host will be called back via the XMLVisitor interface.
-This is essentially a SAX interface for TinyXML-2. (Note however it doesn't re-parse the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this interface versus any other.)
-The interface has been based on ideas from:
- -Which are both good references for "visiting".
-An example of using Accept():
XMLPrinter printer; -tinyxmlDoc.Accept( &printer ); -const char* xmlcstr = printer.CStr(); --
Implements tinyxml2::XMLNode.
- -
-
|
- -virtual | -
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.
- -
-
|
- -virtual | -
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.
- -Implements tinyxml2::XMLNode.
- -
- TinyXML-2
- 5.0.1
-
- |
-
This is the complete list of members for tinyxml2::XMLDocument, including all inherited members.
-
- TinyXML-2
- 5.0.1
-
- |
-
#include <tinyxml2.h>
-Public Member Functions | |
- | XMLDocument (bool processEntities=true, Whitespace whitespaceMode=PRESERVE_WHITESPACE) |
constructor | |
-virtual XMLDocument * | ToDocument () |
Safely cast to a Document, or null. | |
XMLError | Parse (const char *xml, size_t nBytes=(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) |
XMLElement * | RootElement () |
void | Print (XMLPrinter *streamer=0) const |
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) |
-bool | Error () const |
Return true if there was an error parsing the document. | |
-XMLError | ErrorID () const |
Return the errorID. | |
-const char * | GetErrorStr1 () const |
Return a possibly helpful diagnostic location or string. | |
-const char * | GetErrorStr2 () const |
Return a possibly helpful secondary diagnostic location or string. | |
-int | GetErrorLineNum () const |
Return the line where the error occured, or zero if unknown. | |
-void | PrintError () const |
If there is an error, print it to stdout. | |
-void | Clear () |
Clear the document, resetting it to the initial state. | |
void | DeepCopy (XMLDocument *target) |
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) |
-int | GetLineNum () const |
Gets the line number the node is in, if the document was parsed from a file. | |
-const XMLNode * | Parent () const |
Get the parent of this node on the DOM. | |
-bool | NoChildren () const |
Returns true if this node has no children. | |
-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 () |
void | DeleteChild (XMLNode *node) |
XMLNode * | DeepClone (XMLDocument *target) const |
void | SetUserData (void *userData) |
void * | GetUserData () const |
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.
-
-
|
- -virtual | -
Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the XML tree will be conditionally visited and the host will be called back via the XMLVisitor interface.
-This is essentially a SAX interface for TinyXML-2. (Note however it doesn't re-parse the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this interface versus any other.)
-The interface has been based on ideas from:
- -Which are both good references for "visiting".
-An example of using Accept():
XMLPrinter printer; -tinyxmlDoc.Accept( &printer ); -const char* xmlcstr = printer.CStr(); --
Implements tinyxml2::XMLNode.
- -void tinyxml2::XMLDocument::DeepCopy | -( | -XMLDocument * | -target | ) | -- |
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.
- -void tinyxml2::XMLDocument::DeleteNode | -( | -XMLNode * | -node | ) | -- |
Delete a node associated with this document. It will be unlinked from the DOM.
- -
-
|
- -inline | -
Returns true if this document has a leading Byte Order Mark of UTF8.
- -XMLError tinyxml2::XMLDocument::LoadFile | -( | -const char * | -filename | ) | -- |
Load an XML file from disk. Returns XML_SUCCESS (0) on success, or an errorID.
- -XMLError tinyxml2::XMLDocument::LoadFile | -( | -FILE * | -) | -- |
Load an XML file from disk. You are responsible for providing and closing the FILE*.
-NOTE: The file should be opened as binary ("rb") not text in order for TinyXML-2 to correctly do newline normalization.
-Returns XML_SUCCESS (0) on success, or an errorID.
- -XMLComment* tinyxml2::XMLDocument::NewComment | -( | -const char * | -comment | ) | -- |
Create a new Comment associated with this Document. The memory for the Comment is managed by the Document.
- -XMLDeclaration* tinyxml2::XMLDocument::NewDeclaration | -( | -const char * | -text = 0 | ) | -- |
Create a new Declaration associated with this Document. The memory for the object is managed by the Document.
-If the 'text' param is null, the standard declaration is used.:
<?xml version="1.0" encoding="UTF-8"?> --
XMLElement* tinyxml2::XMLDocument::NewElement | -( | -const char * | -name | ) | -- |
Create a new Element associated with this Document. The memory for the Element is managed by the Document.
- -XMLText* tinyxml2::XMLDocument::NewText | -( | -const char * | -text | ) | -- |
Create a new Text associated with this Document. The memory for the Text is managed by the Document.
- -XMLUnknown* tinyxml2::XMLDocument::NewUnknown | -( | -const char * | -text | ) | -- |
Create a new Unknown associated with this Document. The memory for the object is managed by the Document.
- -XMLError tinyxml2::XMLDocument::Parse | -( | -const char * | -xml, | -
- | - | size_t | -nBytes = (size_t)(-1) |
-
- | ) | -- |
Parse an XML file from a character string. Returns XML_SUCCESS (0) on success, or an errorID.
-You may optionally pass in the 'nBytes', which is the number of bytes which will be parsed. If not specified, TinyXML-2 will assume 'xml' points to a null terminated string.
- -void tinyxml2::XMLDocument::Print | -( | -XMLPrinter * | -streamer = 0 | ) | -const | -
Print the Document. If the Printer is not provided, it will print to stdout. If you provide Printer, this can print to a file:
XMLPrinter printer( fp ); -doc.Print( &printer ); -
Or you can use a printer to print to memory:
XMLPrinter printer; -doc.Print( &printer ); -// printer.CStr() has a const char* to the XML --
-
|
- -inline | -
Return the root element of DOM. Equivalent to FirstChildElement(). To get the first node, use FirstChild().
- -XMLError tinyxml2::XMLDocument::SaveFile | -( | -const char * | -filename, | -
- | - | bool | -compact = false |
-
- | ) | -- |
Save the XML file to disk. Returns XML_SUCCESS (0) on success, or an errorID.
- -XMLError tinyxml2::XMLDocument::SaveFile | -( | -FILE * | -fp, | -
- | - | bool | -compact = false |
-
- | ) | -- |
Save the XML file to disk. You are responsible for providing and closing the FILE*.
-Returns XML_SUCCESS (0) on success, or an errorID.
- -
-
|
- -inline | -
Sets whether to write the BOM when writing the file.
- -
-
|
- -inlinevirtual | -
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.
- -
-
|
- -inlinevirtual | -
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.
- -Implements tinyxml2::XMLNode.
- -
- TinyXML-2
- 5.0.1
-
- |
-
This is the complete list of members for tinyxml2::XMLElement, including all inherited members.
-
- TinyXML-2
- 5.0.1
-
- |
-
#include <tinyxml2.h>
-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) |
Set the name of the element. | |
-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 |
-unsigned | UnsignedAttribute (const char *name, unsigned defaultValue=0) const |
See IntAttribute() | |
-int64_t | Int64Attribute (const char *name, int64_t defaultValue=0) const |
See IntAttribute() | |
-bool | BoolAttribute (const char *name, bool defaultValue=false) const |
See IntAttribute() | |
-double | DoubleAttribute (const char *name, double defaultValue=0) const |
See IntAttribute() | |
-float | FloatAttribute (const char *name, float defaultValue=0) const |
See IntAttribute() | |
XMLError | QueryIntAttribute (const char *name, int *value) const |
-XMLError | QueryUnsignedAttribute (const char *name, unsigned int *value) const |
See QueryIntAttribute() | |
-XMLError | QueryInt64Attribute (const char *name, int64_t *value) const |
See QueryIntAttribute() | |
-XMLError | QueryBoolAttribute (const char *name, bool *value) const |
See QueryIntAttribute() | |
-XMLError | QueryDoubleAttribute (const char *name, double *value) const |
See QueryIntAttribute() | |
-XMLError | QueryFloatAttribute (const char *name, float *value) const |
See QueryIntAttribute() | |
int | 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, 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) |
-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) |
-void | SetText (int value) |
Convenience method for setting text inside an element. See SetText() for important limitations. | |
-void | SetText (unsigned value) |
Convenience method for setting text inside an element. See SetText() for important limitations. | |
-void | SetText (int64_t value) |
Convenience method for setting text inside an element. See SetText() for important limitations. | |
-void | SetText (bool value) |
Convenience method for setting text inside an element. See SetText() for important limitations. | |
-void | SetText (double value) |
Convenience method for setting text inside an element. See SetText() for important limitations. | |
-void | SetText (float value) |
Convenience method for setting text inside an element. See SetText() for important limitations. | |
XMLError | QueryIntText (int *ival) const |
-XMLError | QueryUnsignedText (unsigned *uval) const |
See QueryIntText() | |
-XMLError | QueryInt64Text (int64_t *uval) const |
See QueryIntText() | |
-XMLError | QueryBoolText (bool *bval) const |
See QueryIntText() | |
-XMLError | QueryDoubleText (double *dval) const |
See QueryIntText() | |
-XMLError | QueryFloatText (float *fval) const |
See QueryIntText() | |
-unsigned | UnsignedText (unsigned defaultValue=0) const |
See QueryIntText() | |
-int64_t | Int64Text (int64_t defaultValue=0) const |
See QueryIntText() | |
-bool | BoolText (bool defaultValue=false) const |
See QueryIntText() | |
-double | DoubleText (double defaultValue=0) const |
See QueryIntText() | |
-float | FloatText (float defaultValue=0) const |
See QueryIntText() | |
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) |
-int | GetLineNum () const |
Gets the line number the node is in, if the document was parsed from a file. | |
-const XMLNode * | Parent () const |
Get the parent of this node on the DOM. | |
-bool | NoChildren () const |
Returns true if this node has no children. | |
-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 () |
void | DeleteChild (XMLNode *node) |
XMLNode * | DeepClone (XMLDocument *target) const |
void | SetUserData (void *userData) |
void * | GetUserData () const |
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.
-
-
|
- -virtual | -
Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the XML tree will be conditionally visited and the host will be called back via the XMLVisitor interface.
-This is essentially a SAX interface for TinyXML-2. (Note however it doesn't re-parse the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this interface versus any other.)
-The interface has been based on ideas from:
- -Which are both good references for "visiting".
-An example of using Accept():
XMLPrinter printer; -tinyxmlDoc.Accept( &printer ); -const char* xmlcstr = printer.CStr(); --
Implements tinyxml2::XMLNode.
- -const char* tinyxml2::XMLElement::Attribute | -( | -const char * | -name, | -
- | - | 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:
-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(); -
rather than:
if ( ele->Attribute( "foo" ) ) { - if ( strcmp( ele->Attribute( "foo" ), "bar" ) == 0 ) callFooIsBar(); -} --
void tinyxml2::XMLElement::DeleteAttribute | -( | -const char * | -name | ) | -- |
Delete an attribute.
- -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.
-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 ".
- -int tinyxml2::XMLElement::IntAttribute | -( | -const char * | -name, | -
- | - | int | -defaultValue = 0 |
-
- | ) | -const | -
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()).
- -
-
|
- -inline | -
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 --
-
|
- -inline | -
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 --
XMLError tinyxml2::XMLElement::QueryIntText | -( | -int * | -ival | ) | -const | -
Convenience method to query the value of a child text node. This is probably best shown by example. Given you have a document is this form:
<point> - <x>1</x> - <y>1.4</y> - </point> -
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" ); - const XMLElement* yElement = pointElement->FirstChildElement( "y" ); - xElement->QueryIntText( &x ); - yElement->QueryFloatText( &y ); -
void tinyxml2::XMLElement::SetText | -( | -const char * | -inText | ) | -- |
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> --
-
|
- -virtual | -
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.
- -
-
|
- -virtual | -
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.
- -Implements tinyxml2::XMLNode.
- -
- TinyXML-2
- 5.0.1
-
- |
-
This is the complete list of members for tinyxml2::XMLHandle, including all inherited members.
-FirstChild() | tinyxml2::XMLHandle | inline |
FirstChildElement(const char *name=0) | tinyxml2::XMLHandle | inline |
LastChild() | tinyxml2::XMLHandle | inline |
LastChildElement(const char *name=0) | tinyxml2::XMLHandle | inline |
NextSibling() | tinyxml2::XMLHandle | inline |
NextSiblingElement(const char *name=0) | tinyxml2::XMLHandle | inline |
operator=(const XMLHandle &ref) | tinyxml2::XMLHandle | inline |
PreviousSibling() | tinyxml2::XMLHandle | inline |
PreviousSiblingElement(const char *name=0) | tinyxml2::XMLHandle | inline |
ToDeclaration() | tinyxml2::XMLHandle | inline |
ToElement() | tinyxml2::XMLHandle | inline |
ToNode() | tinyxml2::XMLHandle | inline |
ToText() | tinyxml2::XMLHandle | inline |
ToUnknown() | tinyxml2::XMLHandle | inline |
XMLHandle(XMLNode *node) | tinyxml2::XMLHandle | inline |
XMLHandle(XMLNode &node) | tinyxml2::XMLHandle | inline |
XMLHandle(const XMLHandle &ref) | tinyxml2::XMLHandle | inline |
- TinyXML-2
- 5.0.1
-
- |
-
#include <tinyxml2.h>
-Public Member Functions | |
- | 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 & | operator= (const XMLHandle &ref) |
Assignment. | |
-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. | |
-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. | |
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.
-Take an example:
<Document> - <Element attributeA = "valueA"> - <Child attributeB = "value1" /> - <Child attributeB = "value2" /> - </Element> -</Document> -
Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very easy to write a lot of code that looks like:
-XMLElement* root = document.FirstChildElement( "Document" ); -if ( root ) -{ - XMLElement* element = root->FirstChildElement( "Element" ); - if ( element ) - { - XMLElement* child = element->FirstChildElement( "Child" ); - if ( child ) - { - XMLElement* child2 = child->NextSiblingElement( "Child" ); - if ( child2 ) - { - // Finally do something useful. -
And that doesn't even cover "else" cases. XMLHandle addresses the verbosity of such code. A XMLHandle checks for null pointers so it is perfectly safe and correct to use:
-XMLHandle docHandle( &document ); -XMLElement* child2 = docHandle.FirstChildElement( "Document" ).FirstChildElement( "Element" ).FirstChildElement().NextSiblingElement(); -if ( child2 ) -{ - // do something useful -
Which is MUCH more concise and useful.
-It is also safe to copy handles - internally they are nothing more than node pointers.
XMLHandle handleCopy = handle; -
See also XMLConstHandle, which is the same as XMLHandle, but operates on const objects.
-
- TinyXML-2
- 5.0.1
-
- |
-
This is the complete list of members for tinyxml2::XMLNode, including all inherited members.
-
- TinyXML-2
- 5.0.1
-
- |
-
#include <tinyxml2.h>
-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) |
-int | GetLineNum () const |
Gets the line number the node is in, if the document was parsed from a file. | |
-const XMLNode * | Parent () const |
Get the parent of this node on the DOM. | |
-bool | NoChildren () const |
Returns true if this node has no children. | |
-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 () |
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 bool | Accept (XMLVisitor *visitor) const =0 |
void | SetUserData (void *userData) |
void * | GetUserData () const |
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.
-A XMLDocument allocates memory for all its Nodes. When the XMLDocument gets deleted, all its Nodes will also be deleted.
-A Document can contain: Element (container or leaf) - Comment (leaf) - Unknown (leaf) - Declaration( leaf ) - -An Element can contain: Element (container or leaf) - Text (leaf) - Attributes (not on tree) - Comment (leaf) - Unknown (leaf)
-
|
- -pure virtual | -
Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the XML tree will be conditionally visited and the host will be called back via the XMLVisitor interface.
-This is essentially a SAX interface for TinyXML-2. (Note however it doesn't re-parse the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this interface versus any other.)
-The interface has been based on ideas from:
- -Which are both good references for "visiting".
-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.
- -XMLNode* tinyxml2::XMLNode::DeepClone | -( | -XMLDocument * | -target | ) | -const | -
Make a copy of this node and all its children.
-If the 'target' is null, then the nodes will be allocated in the current document. If 'target' is specified, the memory will be allocated is the specified XMLDocument.
-NOTE: This is probably not the correct tool to copy a document, since XMLDocuments can have multiple top level XMLNodes. You probably want to use XMLDocument::DeepCopy()
- -void tinyxml2::XMLNode::DeleteChild | -( | -XMLNode * | -node | ) | -- |
Delete a child of this node.
- -void tinyxml2::XMLNode::DeleteChildren | -( | -) | -- |
Delete all the children of this node.
- -const XMLElement* tinyxml2::XMLNode::FirstChildElement | -( | -const char * | -name = 0 | ) | -const | -
Get the first child element, or optionally the first child element with the specified name.
- -
-
|
- -inline | -
Get user data set into the XMLNode. TinyXML-2 in no way processes or interprets user data. It is initially 0.
- -XMLNode* tinyxml2::XMLNode::InsertAfterChild | -( | -XMLNode * | -afterThis, | -
- | - | XMLNode * | -addThis | -
- | ) | -- |
Add a node after the specified child node. If the child node is already part of the document, it is moved from its old location to the new location. Returns the addThis argument or 0 if the afterThis node is not a child of this node, or if the node does not belong to the same document.
- -Add a child node as the last (right) child. If the child node is already part of the document, it is moved from its old location to the new location. Returns the addThis argument or 0 if the node does not belong to the same document.
- -Add a child node as the first (left) child. If the child node is already part of the document, it is moved from its old location to the new location. Returns the addThis argument or 0 if the node does not belong to the same document.
- -const XMLElement* tinyxml2::XMLNode::LastChildElement | -( | -const char * | -name = 0 | ) | -const | -
Get the last child element or optionally the last child element with the specified name.
- -
-
|
- -inline | -
Set user data into the XMLNode. TinyXML-2 in no way processes or interprets user data. It is initially 0.
- -void tinyxml2::XMLNode::SetValue | -( | -const char * | -val, | -
- | - | bool | -staticMem = false |
-
- | ) | -- |
Set the Value of an XML node.
-
|
- -pure virtual | -
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::XMLDocument, tinyxml2::XMLElement, tinyxml2::XMLUnknown, tinyxml2::XMLDeclaration, tinyxml2::XMLComment, and tinyxml2::XMLText.
- -
-
|
- -pure virtual | -
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::XMLDocument, tinyxml2::XMLElement, tinyxml2::XMLUnknown, tinyxml2::XMLDeclaration, tinyxml2::XMLComment, and tinyxml2::XMLText.
- -const char* tinyxml2::XMLNode::Value | -( | -) | -const | -
The meaning of 'value' changes for the specific type.
Document: empty (NULL is returned, not an empty string) -Element: name of the element -Comment: the comment text -Unknown: the tag contents -Text: the text string --
- TinyXML-2
- 5.0.1
-
- |
-
This is the complete list of members for tinyxml2::XMLPrinter, including all inherited members.
-ClearBuffer() | 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 |
PushAttribute(const char *name, const char *value) | 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(int value) | tinyxml2::XMLPrinter | |
PushText(unsigned value) | tinyxml2::XMLPrinter | |
PushText(int64_t value) | tinyxml2::XMLPrinter | |
PushText(bool 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 |
- TinyXML-2
- 5.0.1
-
- |
-
#include <tinyxml2.h>
-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) |
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 an unsigned. | |
-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. | |
-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 |
void | ClearBuffer () |
-Protected Member Functions | |
virtual void | PrintSpace (int depth) |
Printing functionality. The XMLPrinter gives you more options than the XMLDocument::Print() method.
-It can:
Print to Memory
-XMLPrinter printer; -doc.Print( &printer ); -SomeFunction( printer.CStr() ); -
Print to a File
-You provide the file pointer.
XMLPrinter printer( fp ); -doc.Print( &printer ); -
Print without a XMLDocument
-When loading, an XML parser is very useful. However, sometimes when saving, it just gets in the way. The code is often set up for streaming, and constructing the DOM is just overhead.
-The Printer supports the streaming case. The following code prints out a trivially simple XML file without ever creating an XML document.
-XMLPrinter printer( fp ); -printer.OpenElement( "foo" ); -printer.PushAttribute( "foo", "bar" ); -printer.CloseElement(); -
tinyxml2::XMLPrinter::XMLPrinter | -( | -FILE * | -file = 0 , |
-
- | - | bool | -compact = false , |
-
- | - | int | -depth = 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.
- -
-
|
- -inline | -
If in print to memory mode, reset the buffer to the beginning.
- -
-
|
- -inline | -
If in print to memory mode, return a pointer to the XML file in memory.
- -
-
|
- -inline | -
If in print to memory mode, return the size of the XML file in memory. (Note the size returned includes the terminating null.)
- -void tinyxml2::XMLPrinter::OpenElement | -( | -const char * | -name, | -
- | - | bool | -compactMode = false |
-
- | ) | -- |
If streaming, start writing an element. The element must be closed with CloseElement()
- -
-
|
- -protectedvirtual | -
Prints out the space before an element. You may override to change the space and tabs used. A PrintSpace() override should call Print().
- -void tinyxml2::XMLPrinter::PushHeader | -( | -bool | -writeBOM, | -
- | - | bool | -writeDeclaration | -
- | ) | -- |
If streaming, write the BOM and declaration.
- -
- TinyXML-2
- 5.0.1
-
- |
-
This is the complete list of members for tinyxml2::XMLText, including all inherited members.
-
- TinyXML-2
- 5.0.1
-
- |
-
#include <tinyxml2.h>
-Public Member Functions | |
virtual bool | Accept (XMLVisitor *visitor) const |
-virtual XMLText * | ToText () |
Safely cast to Text, or null. | |
-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. | |
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) |
-int | GetLineNum () const |
Gets the line number the node is in, if the document was parsed from a file. | |
-const XMLNode * | Parent () const |
Get the parent of this node on the DOM. | |
-bool | NoChildren () const |
Returns true if this node has no children. | |
-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 () |
void | DeleteChild (XMLNode *node) |
XMLNode * | DeepClone (XMLDocument *target) const |
void | SetUserData (void *userData) |
void * | GetUserData () const |
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().
-
-
|
- -virtual | -
Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the XML tree will be conditionally visited and the host will be called back via the XMLVisitor interface.
-This is essentially a SAX interface for TinyXML-2. (Note however it doesn't re-parse the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this interface versus any other.)
-The interface has been based on ideas from:
- -Which are both good references for "visiting".
-An example of using Accept():
XMLPrinter printer; -tinyxmlDoc.Accept( &printer ); -const char* xmlcstr = printer.CStr(); --
Implements tinyxml2::XMLNode.
- -
-
|
- -virtual | -
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.
- -
-
|
- -virtual | -
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.
- -Implements tinyxml2::XMLNode.
- -
- TinyXML-2
- 5.0.1
-
- |
-
This is the complete list of members for tinyxml2::XMLUnknown, including all inherited members.
-
- TinyXML-2
- 5.0.1
-
- |
-
#include <tinyxml2.h>
-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) |
-int | GetLineNum () const |
Gets the line number the node is in, if the document was parsed from a file. | |
-const XMLNode * | Parent () const |
Get the parent of this node on the DOM. | |
-bool | NoChildren () const |
Returns true if this node has no children. | |
-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 () |
void | DeleteChild (XMLNode *node) |
XMLNode * | DeepClone (XMLDocument *target) const |
void | SetUserData (void *userData) |
void * | GetUserData () const |
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.
-
-
|
- -virtual | -
Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the XML tree will be conditionally visited and the host will be called back via the XMLVisitor interface.
-This is essentially a SAX interface for TinyXML-2. (Note however it doesn't re-parse the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this interface versus any other.)
-The interface has been based on ideas from:
- -Which are both good references for "visiting".
-An example of using Accept():
XMLPrinter printer; -tinyxmlDoc.Accept( &printer ); -const char* xmlcstr = printer.CStr(); --
Implements tinyxml2::XMLNode.
- -
-
|
- -virtual | -
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.
- -
-
|
- -virtual | -
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.
- -Implements tinyxml2::XMLNode.
- -
- TinyXML-2
- 5.0.1
-
- |
-
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 XMLComment &) | tinyxml2::XMLVisitor | inlinevirtual |
Visit(const XMLUnknown &) | tinyxml2::XMLVisitor | inlinevirtual |
VisitEnter(const XMLDocument &) | tinyxml2::XMLVisitor | inlinevirtual |
VisitEnter(const XMLElement &, const XMLAttribute *) | tinyxml2::XMLVisitor | inlinevirtual |
VisitExit(const XMLDocument &) | tinyxml2::XMLVisitor | inlinevirtual |
VisitExit(const XMLElement &) | tinyxml2::XMLVisitor | inlinevirtual |
- TinyXML-2
- 5.0.1
-
- |
-
#include <tinyxml2.h>
-Public Member Functions | |
-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().
-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.
-You should never change the document from a callback.
-
- TinyXML-2
- 5.0.1
-
- |
-
- TinyXML-2
- 5.0.1
-
- |
-
- TinyXML-2
- 5.0.1
-
- |
-
- TinyXML-2
- 5.0.1
-
- |
-
- TinyXML-2
- 5.0.1
-
- |
-
TinyXML-2 is a simple, small, efficient, C++ XML parser that can be easily integrated into other programs.
-The master is hosted on github: https://github.com/leethomason/tinyxml2
-The online HTML version of these docs: http://leethomason.github.io/tinyxml2/
-Examples are in the "related pages" tab of the HTML docs.
-In brief, TinyXML-2 parses an XML document, and builds from that a Document Object Model (DOM) that can be read, modified, and saved.
-XML stands for "eXtensible Markup Language." It is a general purpose human and machine readable markup language to describe arbitrary data. All those random file formats created to store application data can all be replaced with XML. One parser for everything.
-http://en.wikipedia.org/wiki/XML
-There are different ways to access and interact with XML data. TinyXML-2 uses a Document Object Model (DOM), meaning the XML data is parsed into a C++ objects that can be browsed and manipulated, and then written to disk or another output stream. You can also construct an XML document from scratch with C++ objects and write this to disk or another output stream. You can even use TinyXML-2 to stream XML programmatically from code without creating a document first.
-TinyXML-2 is designed to be easy and fast to learn. It is one header and one cpp file. Simply add these to your project and off you go. There is an example file - xmltest.cpp - to get you started.
-TinyXML-2 is released under the ZLib license, so you can use it in open source or commercial code. The details of the license are at the top of every source file.
-TinyXML-2 attempts to be a flexible parser, but with truly correct and compliant XML output. TinyXML-2 should compile on any reasonably C++ compliant system. It does not rely on exceptions, RTTI, or the STL.
-TinyXML-2 doesn't parse or use DTDs (Document Type Definitions) or XSLs (eXtensible Stylesheet Language.) There are other parsers out there that are much more fully featured. But they are also much bigger, take longer to set up in your project, have a higher learning curve, and often have a more restrictive license. If you are working with browsers or have more complete XML needs, TinyXML-2 is not the parser for you.
-TinyXML-2 is now the focus of all development, well tested, and your best choice unless you have a requirement to maintain TinyXML-1 code.
-TinyXML-2 uses a similar API to TinyXML-1 and the same rich test cases. But the implementation of the parser is completely re-written to make it more appropriate for use in a game. It uses less memory, is faster, and uses far fewer memory allocations.
-TinyXML-2 has no requirement for STL, but has also dropped all STL support. All strings are query and set as 'const char*'. This allows the use of internal allocators, and keeps the code much simpler.
-Both parsers:
-Advantages of TinyXML-2
-Advantages of TinyXML-1
-An XMLDocument is a C++ object like any other, that can be on the stack, or new'd and deleted on the heap.
-However, any sub-node of the Document, XMLElement, XMLText, etc, can only be created by calling the appropriate XMLDocument::NewElement, NewText, etc. method. Although you have pointers to these objects, they are still owned by the Document. When the Document is deleted, so are all the nodes it contains.
-Microsoft has an excellent article on white space: http://msdn.microsoft.com/en-us/library/ms256097.aspx
-By default, TinyXML-2 preserves white space in a (hopefully) sane way that is almost compliant with the spec. (TinyXML-1 used a completely different model, much more similar to 'collapse', below.)
-As a first step, all newlines / carriage-returns / line-feeds are normalized to a line-feed character, as required by the XML spec.
-White space in text is preserved. For example:
<element> Hello, World</element> -
The leading space before the "Hello" and the double space after the comma are preserved. Line-feeds are preserved, as in this example:
<element> Hello again, - World</element> -
However, white space between elements is not preserved. Although not strictly compliant, tracking and reporting inter-element space is awkward, and not normally valuable. TinyXML-2 sees these as the same XML:
<document> - <data>1</data> - <data>2</data> - <data>3</data> -</document> - -<document><data>1</data><data>2</data><data>3</data></document> -
For some applications, it is preferable to collapse whitespace. Collapsing whitespace gives you "HTML-like" behavior, which is sometimes more suitable for hand typed documents.
-TinyXML-2 supports this with the 'whitespace' parameter to the XMLDocument constructor. (The default is to preserve whitespace, as described above.)
-However, you may also use COLLAPSE_WHITESPACE, which will:
-Note that (currently) there is a performance impact for using COLLAPSE_WHITESPACE. It essentially causes the XML to be parsed twice.
-TinyXML-2 reports the line number of any errors in an XML document that cannot be parsed correctly. In addition, all nodes (elements, declarations, text, comments etc.) and attributes have a line number recorded as they are parsed. This allows an application that performs additional validation of the parsed XML document (e.g. application-implemented DTD validation) to report line number information in it's errors.
-TinyXML-2 recognizes the pre-defined "character entities", meaning special characters. Namely:
& & -< < -> > -" " -' ' -
These are recognized when the XML document is read, and translated to their UTF-8 equivalents. For instance, text with the XML of:
Far & Away -
will have the Value() of "Far & Away" when queried from the XMLText object, and will be written back to the XML stream/file as an ampersand.
-Additionally, any character can be specified by its Unicode code point: The syntax  
or  
are both to the non-breaking space character. This is called a 'numeric character reference'. Any numeric character reference that isn't one of the special entities above, will be read, but written as a regular code point. The output is correct, but the entity syntax isn't preserved.
You can directly use the convenience function:
XMLDocument doc; -... -doc.SaveFile( "foo.xml" ); -
Or the XMLPrinter class:
XMLPrinter printer( fp ); -doc.Print( &printer ); -
Printing to memory is supported by the XMLPrinter.
XMLPrinter printer; -doc.Print( &printer ); -// printer.CStr() has a const char* to the XML -
When loading, an XML parser is very useful. However, sometimes when saving, it just gets in the way. The code is often set up for streaming, and constructing the DOM is just overhead.
-The Printer supports the streaming case. The following code prints out a trivially simple XML file without ever creating an XML document.
XMLPrinter printer( fp ); -printer.OpenElement( "foo" ); -printer.PushAttribute( "foo", "bar" ); -printer.CloseElement(); -
/* ------ Example 1: Load and parse an XML file. ---- */ -{ - XMLDocument doc; - doc.LoadFile( "dream.xml" ); -} -
/* ------ Example 2: Lookup information. ---- */ -{ - XMLDocument doc; - doc.LoadFile( "dream.xml" ); - - // Structure of the XML file: - // - Element "PLAY" the root Element, which is the - // FirstChildElement of the Document - // - - Element "TITLE" child of the root PLAY Element - // - - - Text child of the TITLE Element - - // Navigate to the title, using the convenience function, - // with a dangerous lack of error checking. - const char* title = doc.FirstChildElement( "PLAY" )->FirstChildElement( "TITLE" )->GetText(); - printf( "Name of play (1): %s\n", title ); - - // Text is just another Node to TinyXML-2. The more - // general way to get to the XMLText: - XMLText* textNode = doc.FirstChildElement( "PLAY" )->FirstChildElement( "TITLE" )->FirstChild()->ToText(); - title = textNode->Value(); - printf( "Name of play (2): %s\n", title ); -} -
There are 2 files in TinyXML-2:
And additionally a test file:
Simply compile and run. There is a visual studio 2015 project included, a simple Makefile, an Xcode project, a Code::Blocks project, and a cmake CMakeLists.txt included to help you. The top of tinyxml.h even has a simple g++ command line if you are are *nix and don't want to use a build system.
-TinyXML-2 uses semantic versioning. http://semver.org/ Releases are now tagged in github.
-Note that the major version will (probably) change fairly rapidly. API changes are fairly common.
-The documentation is build with Doxygen, using the 'dox' configuration file.
-TinyXML-2 is released under the zlib license:
-This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
-Thanks very much to everyone who sends suggestions, bugs, ideas, and encouragement. It all helps, and makes this project fun.
-The original TinyXML-1 has many contributors, who all deserve thanks in shaping what is a very successful library. Extra thanks to Yves Berquin and Andrew Ellerton who were key contributors.
-TinyXML-2 grew from that effort. Lee Thomason is the original author of TinyXML-2 (and TinyXML-1) but TinyXML-2 has been and is being improved by many contributors.
-Thanks to John Mackay at http://john.mackay.rosalilastudio.com for the TinyXML-2 logo!
-t |