panda3d.core.TiXmlElement

class TiXmlElement

Bases: TiXmlNode

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.

Inheritance diagram

Inheritance diagram of TiXmlElement

Attribute(name: str) → str

Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.

Attribute(name: str) → str
FirstAttribute() → TiXmlAttribute

///< Access the first attribute in this element.

Return type

TiXmlAttribute

FirstAttribute() → TiXmlAttribute

///< Access the first attribute in this element.

Return type

TiXmlAttribute

GetText() → str

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:

<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 “.

WARNING: GetText() accesses a child node - don’t become confused with the similarly named TiXmlHandle.Text() and TiXmlNode.ToText() which are safe type casts on the referenced node.

LastAttribute() → TiXmlAttribute

///< Access the last attribute in this element.

Return type

TiXmlAttribute

LastAttribute() → TiXmlAttribute

///< Access the last attribute in this element.

Return type

TiXmlAttribute

RemoveAttribute(name: str) → None

Deletes an attribute with the given name.

RemoveAttribute(name: str) → None

///< STL std::string form.

SetAttribute(name: str, _value: str) → None

Sets an attribute of name to a given value. The attribute will be created if it does not exist, or changed if it does.

SetAttribute(name: str, value: int) → None

Sets an attribute of name to a given value. The attribute will be created if it does not exist, or changed if it does.

SetAttribute(name: str, _value: int) → None

///< STL std::string form.

SetAttribute(name: str, _value: str) → None

/// STL std::string form.

SetDoubleAttribute(name: str, value: float) → None

Sets an attribute of name to a given value. The attribute will be created if it does not exist, or changed if it does.

SetDoubleAttribute(name: str, value: float) → None

///< STL std::string form.

__init__(param0: TiXmlElement) → None
__init__(in_value: str) → None

/// Construct an element.

__init__(_value: str) → None

/// std::string constructor.

assign(base: TiXmlElement) → TiXmlElement
Return type

TiXmlElement