pugixml.pugi.XMLAttribute
- class pugixml.pugi.XMLAttribute
Bases:
pybind11_objectA light-weight handle for manipulating attributes in the DOM tree.
Methods
__bool__(self)Determine if this attribute is not empty.
__eq__(self, other)Return self == other.
__ge__(self, other)Return self >= other.
__gt__(self, other)Return self > other.
__hash__(self)Return the hash value (unique for handles to the same object).
__init__(*args, **kwargs)Overloaded function.
__le__(self, other)Return self <= other.
__lt__(self, other)Return self < other.
__ne__(self, other)Return self != other.
as_bool(self[, default])Return the attribute value as a boolean.
as_double(self[, default])as_float(self[, default])as_int(self[, default])as_llong(self[, default])Return the attribute value as a number [
LLONG_MIN,LLONG_MAX].as_string(self[, default])Return the attribute value.
as_uint(self[, default])Return the attribute value as a number [0,
UINT_MAX].as_ullong(self[, default])Return the attribute value as a number [0,
ULLONG_MAX].empty(self)Determine if this attribute is empty.
hash_value(self)Return the hash value (unique for handles to the same object).
internal_object(self)Return the internal object.
name(self)Return the attribute name.
next_attribute(self)Return the next attribute in the list of attributes of the parent node.
previous_attribute(self)Return the previous attribute in the list of attributes of the parent node.
set_name(*args, **kwargs)Overloaded function.
set_value(*args, **kwargs)Overloaded function.
value(self)Return the attribute value.
Member Documentation
- __bool__(self: pugixml.pugi.XMLAttribute) bool
Determine if this attribute is not empty.
- Returns:
Trueif this attribute is not empty,Falseotherwise.
- __eq__(self: pugixml.pugi.XMLAttribute, other: pugixml.pugi.XMLAttribute) bool
Return self == other.
- Parameters:
other – The attribute to compare.
- Returns:
Trueif the internal objects are the same,Falseotherwise.
- __ge__(self: pugixml.pugi.XMLAttribute, other: pugixml.pugi.XMLAttribute) bool
Return self >= other.
- Parameters:
other – The attribute to compare.
- Returns:
Trueif the result of comparing the internal objects is true,Falseotherwise.
- __gt__(self: pugixml.pugi.XMLAttribute, other: pugixml.pugi.XMLAttribute) bool
Return self > other.
- Parameters:
other – The attribute to compare.
- Returns:
Trueif the result of comparing the internal objects is true,Falseotherwise.
- __hash__(self: pugixml.pugi.XMLAttribute) int
Return the hash value (unique for handles to the same object).
This is equivalent to
hash_value().- Returns:
The hash value.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: pugixml.pugi.XMLAttribute) -> None
Initialize
XMLAttributeas an empty attribute.__init__(self: pugixml.pugi.XMLAttribute, p: pugixml.pugi.XMLAttributeStruct) -> None
Initialize
XMLAttributewith the internal object.
- Parameters:
p – The internal object of the attribute to shallow copy.
- __le__(self: pugixml.pugi.XMLAttribute, other: pugixml.pugi.XMLAttribute) bool
Return self <= other.
- Parameters:
other – The attribute to compare.
- Returns:
Trueif the result of comparing the internal objects is true,Falseotherwise.
- __lt__(self: pugixml.pugi.XMLAttribute, other: pugixml.pugi.XMLAttribute) bool
Return self < other.
- Parameters:
other – The attribute to compare.
- Returns:
Trueif the result of comparing the internal objects is true,Falseotherwise.
- __ne__(self: pugixml.pugi.XMLAttribute, other: pugixml.pugi.XMLAttribute) bool
Return self != other.
- Parameters:
other – The attribute to compare.
- Returns:
Trueif the internal objects are not the same,Falseotherwise.
- as_bool(self: pugixml.pugi.XMLAttribute, default: bool = False) bool
Return the attribute value as a boolean.
- Parameters:
default – The default value to return if the conversion fails or the attribute is empty.
- Returns:
The attribute value as a boolean (returns
Trueif the first character is in ‘1tTyY’ set), or the default value if the conversion fails or the attribute is empty.
- as_double(self: pugixml.pugi.XMLAttribute, default: SupportsFloat | SupportsIndex = 0) float
Return the attribute value as a number [
DBL_MIN,DBL_MAX].- Parameters:
default – The default value to return if the conversion fails or the attribute is empty.
- Returns:
The attribute value as a number, or the default value if the conversion fails or the attribute is empty.
- as_float(self: pugixml.pugi.XMLAttribute, default: SupportsFloat | SupportsIndex = 0) float
Return the attribute value as a number [
FLT_MIN,FLT_MAX].- Parameters:
default – The default value to return if the conversion fails or the attribute is empty.
- Returns:
The attribute value as a number, or the default value if the conversion fails or the attribute is empty.
- as_int(self: pugixml.pugi.XMLAttribute, default: SupportsInt | SupportsIndex = 0) int
Return the attribute value as a number [
INT_MIN,INT_MAX].- Parameters:
default – The default value to return if the conversion fails or the attribute is empty.
- Returns:
The attribute value as a number, or the default value if the conversion fails or the attribute is empty.
- as_llong(self: pugixml.pugi.XMLAttribute, default: SupportsInt | SupportsIndex = 0) int
Return the attribute value as a number [
LLONG_MIN,LLONG_MAX].- Parameters:
default – The default value to return if the conversion fails or the attribute is empty.
- Returns:
The attribute value as a number, or the default value if the conversion fails or the attribute is empty.
- as_string(self: pugixml.pugi.XMLAttribute, default: str = '') str
Return the attribute value.
- Parameters:
default – The default value to return if the attribute is empty.
- Returns:
The attribute value, or the default value if the attribute is empty.
- as_uint(self: pugixml.pugi.XMLAttribute, default: SupportsInt | SupportsIndex = 0) int
Return the attribute value as a number [0,
UINT_MAX].- Parameters:
default – The default value to return if the conversion fails or the attribute is empty.
- Returns:
The attribute value as a number, or the default value if the conversion fails or the attribute is empty.
- as_ullong(self: pugixml.pugi.XMLAttribute, default: SupportsInt | SupportsIndex = 0) int
Return the attribute value as a number [0,
ULLONG_MAX].- Parameters:
default – The default value to return if the conversion fails or the attribute is empty.
- Returns:
The attribute value as a number, or the default value if the conversion fails or the attribute is empty.
- empty(self: pugixml.pugi.XMLAttribute) bool
Determine if this attribute is empty.
- Returns:
Trueif this attribute is empty,Falseotherwise.
- hash_value(self: pugixml.pugi.XMLAttribute) int
Return the hash value (unique for handles to the same object).
- Returns:
The hash value.
- internal_object(self: pugixml.pugi.XMLAttribute) pugixml.pugi.XMLAttributeStruct
Return the internal object.
- Returns:
The internal object of this attribute.
- name(self: pugixml.pugi.XMLAttribute) str
Return the attribute name.
- Returns:
The attribute name, or an empty string if the attribute is empty.
- next_attribute(self: pugixml.pugi.XMLAttribute) pugixml.pugi.XMLAttribute
Return the next attribute in the list of attributes of the parent node.
- Returns:
The next sibling of this attribute, or empty attribute if nothing exists.
- previous_attribute(self: pugixml.pugi.XMLAttribute) pugixml.pugi.XMLAttribute
Return the previous attribute in the list of attributes of the parent node.
- Returns:
The previous sibling of this attribute, or empty attribute if nothing exists.
- set_name(*args, **kwargs)
Overloaded function.
set_name(self: pugixml.pugi.XMLAttribute, name: str) -> bool
Set the attribute name.
set_name(self: pugixml.pugi.XMLAttribute, name: str, size: typing.SupportsInt | typing.SupportsIndex) -> bool
Set the attribute name with the specified length.
- Parameters:
name – The attribute name to set.
size – The length of the attribute name.
- Returns:
Falseif the attribute is empty or there is not enough memory.
- set_value(*args, **kwargs)
Overloaded function.
set_value(self: pugixml.pugi.XMLAttribute, value: str) -> bool
Set the attribute value.
set_value(self: pugixml.pugi.XMLAttribute, value: str, size: typing.SupportsInt | typing.SupportsIndex) -> bool
Set the attribute value with the specified length.
set_value(self: pugixml.pugi.XMLAttribute, value: bool) -> bool
Set the attribute value as a boolean (true or false).
set_value(self: pugixml.pugi.XMLAttribute, value: float) -> bool
set_value(self: pugixml.pugi.XMLAttribute, value: typing.SupportsFloat | typing.SupportsIndex, precision: typing.SupportsInt | typing.SupportsIndex) -> bool
set_value(self: pugixml.pugi.XMLAttribute, value: typing.SupportsInt | typing.SupportsIndex) -> bool
set_value(self: pugixml.pugi.XMLAttribute, value: typing.SupportsInt | typing.SupportsIndex) -> bool
Set the attribute value as a number [0,
ULLONG_MAX].
- Parameters:
value – The attribute value to set.
size – The length of the attribute value as a string.
precision – The precision of the attribute value as a floating point number.
- Returns:
Falseif the attribute is empty or there is not enough memory.
- value(self: pugixml.pugi.XMLAttribute) str
Return the attribute value.
- Returns:
The attribute value, or an empty string if the attribute is empty.
See also