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.
Class XMLElement
#include <Geode/cocos/support/tinyxml2/tinyxml2.h>
Examples0
Public static methods0
Public member functions34
charconst*Name()const
/// Get the name of an element (which is the Value() of the node.)
voidSetName(charconst*str,boolstaticMem)
/// Set the name of the element.
virtualtinyxml2::XMLElement*ToElement()
virtualtinyxml2::XMLElementconst*ToElement()const
virtualboolAccept(tinyxml2::XMLVisitor*visitor)const
charconst*Attribute(charconst*name,charconst*value)const
Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists. For example:
intIntAttribute(charconst*name)const
Given an attribute name, IntAttribute() returns the value of the attribute interpreted as an integer. 0 will be returned if there is an error. For a method with error checking, see QueryIntAttribute()
uintUnsignedAttribute(charconst*name)const
/// See IntAttribute()
boolBoolAttribute(charconst*name)const
/// See IntAttribute()
doubleDoubleAttribute(charconst*name)const
/// See IntAttribute()
floatFloatAttribute(charconst*name)const
/// See IntAttribute()
tinyxml2::XMLErrorQueryIntAttribute(charconst*name,int*value)const
Given an attribute name, QueryIntAttribute() returns XML_NO_ERROR, 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:
tinyxml2::XMLErrorQueryUnsignedAttribute(charconst*name,uint*value)const
/// See QueryIntAttribute()
tinyxml2::XMLErrorQueryBoolAttribute(charconst*name,bool*value)const
/// See QueryIntAttribute()
tinyxml2::XMLErrorQueryDoubleAttribute(charconst*name,double*value)const
/// See QueryIntAttribute()
tinyxml2::XMLErrorQueryFloatAttribute(charconst*name,float*value)const
/// See QueryIntAttribute()
voidSetAttribute(charconst*name,charconst*value)
/// Sets the named attribute to value.
voidSetAttribute(charconst*name,intvalue)
/// Sets the named attribute to value.
voidSetAttribute(charconst*name,uintvalue)
/// Sets the named attribute to value.
voidSetAttribute(charconst*name,boolvalue)
/// Sets the named attribute to value.
voidSetAttribute(charconst*name,doublevalue)
/// Sets the named attribute to value.
voidDeleteAttribute(charconst*name)
Delete an attribute.
tinyxml2::XMLAttributeconst*FirstAttribute()const
/// Return the first attribute in the list.
tinyxml2::XMLAttributeconst*FindAttribute(charconst*name)const
/// Query a specific attribute in the list.
charconst*GetText()const
Convenience function for easy access to the text inside an element. Although easy and concise, GetText() is limited compared to getting the TiXmlText child and accessing it directly. If the first child of ‘this’ is a TiXmlText, 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:
tinyxml2::XMLErrorQueryIntText(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:
tinyxml2::XMLErrorQueryUnsignedText(uint*uval)const
/// See QueryIntText()
tinyxml2::XMLErrorQueryBoolText(bool*bval)const
/// See QueryIntText()
tinyxml2::XMLErrorQueryDoubleText(double*dval)const
/// See QueryIntText()
tinyxml2::XMLErrorQueryFloatText(float*fval)const
/// See QueryIntText()