TiXmlElement

from panda3d.core import TiXmlElement
class TiXmlElement

Bases:

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.

FirstAttribute() TiXmlAttribute

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

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.

LastAttribute() TiXmlAttribute

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

RemoveAttribute(name: str)

Deletes an attribute with the given name.

RemoveAttribute(name: str)

///< STL std::string form.

SetAttribute(name: str, _value: str)

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)

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)

///< STL std::string form.

SetAttribute(name: str, _value: str)

/// STL std::string form.

SetDoubleAttribute(name: str, value: float)

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)

///< STL std::string form.

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

/// Construct an element.

__init__(_value: str)

/// std::string constructor.

assign(base: TiXmlElement) TiXmlElement