pugixml.pugi.XMLTextΒΆ

class pugixml.pugi.XMLText

Bases: pybind11_object

A helper for working with text inside PCDATA nodes.

Examples

>>> from pugixml import pugi
>>> doc = pugi.XMLDocument()
>>> doc.load_string('<node/>')
>>> node = doc.child('node')
>>> a = node.append_child('a').append_child(pugi.NODE_CDATA)
>>> a.text().set('foo')
>>> b = node.append_child(pugi.NODE_PCDATA)
>>> b.text().set('bar')
>>> c = node.append_child(pugi.NODE_ELEMENT)
>>> c.set_name('c')
>>> c.text().set('baz')
>>> node.print(pugi.PrintWriter(), indent=' ')
<node>
 <a><![CDATA[foo]]></a>bar<c>baz</c>
</node>

Members:

__bool__(self)

Determine if this object is not empty.

__init__(self)

Initialize XMLText as an empty text.

as_bool(self[, default])

Return the contents as a boolean.

as_double(self[, default])

Return the contents as a number [DBL_MIN, DBL_MAX].

as_float(self[, default])

Return the contents as a number [FLT_MIN, FLT_MAX].

as_int(self[, default])

Return the contents as a number [INT_MIN, INT_MAX].

as_llong(self[, default])

Return the contents as a number [LLONG_MIN, LLONG_MAX].

as_string(self[, default])

Return the contents.

as_uint(self[, default])

Return the contents as a number [0, UINT_MAX].

as_ullong(self[, default])

Return the contents as a number [0, ULLONG_MAX].

data(self)

Return the data node (NODE_PCDATA or NODE_CDATA) for this object.

empty(self)

Determine if this object is empty.

get(self)

Return the contents.

set(*args, **kwargs)

Overloaded function.