pugixml.pugi.XPathVariable

class pugixml.pugi.XPathVariable

Bases: pybind11_object

A single XPath variable.

See also

XPathVariableSet

Methods

__init__(*args, **kwargs)

get_boolean(self)

Return the variable value without type conversion.

get_node_set(self)

Return the variable value without type conversion.

get_number(self)

Return the variable value without type conversion.

get_string(self)

Return the variable value without type conversion.

name(self)

Return the variable name.

set(*args, **kwargs)

Overloaded function.

type(self)

Return the variable type.

Member Documentation

__init__(*args, **kwargs)
get_boolean(self: pugixml.pugi.XPathVariable) bool

Return the variable value without type conversion.

Returns:

The variable value, or False if variable type does not match.

get_node_set(self: pugixml.pugi.XPathVariable) pugixml.pugi.XPathNodeSet

Return the variable value without type conversion.

Returns:

The variable value, or empty node set if variable type does not match.

get_number(self: pugixml.pugi.XPathVariable) float

Return the variable value without type conversion.

Returns:

The variable value, or float('nan') if variable type does not match.

get_string(self: pugixml.pugi.XPathVariable) str

Return the variable value without type conversion.

Returns:

The variable value, or an empty string if variable type does not match.

name(self: pugixml.pugi.XPathVariable) str

Return the variable name.

Returns:

The variable name.

set(*args, **kwargs)

Overloaded function.

  1. set(self: pugixml.pugi.XPathVariable, value: typing.SupportsFloat | typing.SupportsIndex) -> bool

    Set the variable value as a number [DBL_MIN, DBL_MAX].

  2. set(self: pugixml.pugi.XPathVariable, value: bool) -> bool

    Set the variable value as a boolean.

  3. set(self: pugixml.pugi.XPathVariable, value: str) -> bool

    Set the variable value as a string.

  4. set(self: pugixml.pugi.XPathVariable, value: pugixml.pugi.XPathNodeSet) -> bool

    Set the variable value as the XPath node set.

Parameters:

value – The variable value to set.

Returns:

False if variable type does not match or there is not enough memory.

type(self: pugixml.pugi.XPathVariable) pugixml.pugi.XPathValueType

Return the variable type.

Returns:

The variable type.