pugixml.pugi.XPathVariableSet

class pugixml.pugi.XPathVariableSet

Bases: pybind11_object

A set of XPath variables.

Methods

__init__(self)

Initialize XPathVariableSet.

add(self, name, value_type)

Add a new variable and return it, or return the existing one if the types match.

get(self, name)

Return the existing variable with the specified name.

set(*args, **kwargs)

Overloaded function.

Member Documentation

__init__(self: pugixml.pugi.XPathVariableSet) None

Initialize XPathVariableSet.

add(self: pugixml.pugi.XPathVariableSet, name: str, value_type: pugixml.pugi.XPathValueType) pugixml.pugi.XPathVariable | None

Add a new variable and return it, or return the existing one if the types match.

Parameters:
  • name – The variable name to add/get.

  • value_type – The variable type to add/get.

Returns:

The variable added or the existing one if the types matches, or None if nothing exists or there is not enough memory.

get(self: pugixml.pugi.XPathVariableSet, name: str) pugixml.pugi.XPathVariable | None

Return the existing variable with the specified name.

Parameters:

name – The variable name to get.

Returns:

The variable if exists, None otherwise.

set(*args, **kwargs)

Overloaded function.

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

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

    No type conversion is performed.

  2. set(self: pugixml.pugi.XPathVariableSet, name: str, value: bool) -> bool

    Set the value of an existing variable as a boolean.

    No type conversion is performed.

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

    Set the value of an existing variable as a string.

    No type conversion is performed.

  4. set(self: pugixml.pugi.XPathVariableSet, name: str, value: pugixml.pugi.XPathNodeSet) -> bool

    Set the value of an existing variable as the XPath node set.

    No type conversion is performed.

These are equivalent to add(name, value_type).set(value).

Parameters:
  • name – The variable name to set.

  • value – The variable value to set.

Returns:

False if there is no such variable or if types mismatch.