etree - Add-ons for the ElemenTree library

Utilities for the ElementTree standard library package.

util - Various utilities

ElemenTree related utility classes and functions.

Requires at least Python 2.6. Simple import breaks on Python 2.5

class ContainerElementMixin(parent, root_tag, namespace='')[source]
__init__(parent, root_tag, namespace='')[source]

x.__init__(…) initializes x; see help(type(x)) for signature

__len__()[source]
class MappingElement(parent, root_tag, namespace='')[source]
__abstractmethods__ = frozenset([])
__delitem__(key)[source]
__getitem__(key)[source]
__init__(parent, root_tag, namespace='')[source]

x.__init__(…) initializes x; see help(type(x)) for signature

__iter__()[source]
__setitem__(key, value)[source]
class MappingElementIterator(element)[source]
__abstractmethods__ = frozenset([])
__init__(element)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

next()[source]

Return the next item from the iterator. When exhausted, raise StopIteration

class Namespace(url='', element=None)[source]

Represents an XML namespace and provides several utility functions that help handle a document without namespace tags.

Element(tag, attrib={}, **extra)[source]
SubElement(parent, tag, attrib={}, **extra)[source]
__init__(url='', element=None)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

find(element, tag)[source]
findall(element, tag)[source]
findtext(element, tag, default=None)[source]
get_tag(element)[source]
class QName(tag)[source]

Represents a qualified name

__init__(tag)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

__str__() <==> str(x)[source]
text
class SequenceElement(parent, root_tag, element_tag, namespace='', indent=' ')[source]
__abstractmethods__ = frozenset([])
__delitem__(index)[source]
__getitem__(index)[source]
__init__(parent, root_tag, element_tag, namespace='', indent=' ')[source]

x.__init__(…) initializes x; see help(type(x)) for signature

__setitem__(index, value)[source]
insert(index, value)[source]

S.insert(index, object) – insert object before index

class Writer(root_tag, attributes=None, tab_size=0)[source]
__init__(root_tag, attributes=None, tab_size=0)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

marshal(node)[source]
write(node, where)[source]
make_property(elem, key=None)[source]

Creates a property on the text of element ‘elem’ or, if the ‘key’ argument is given, on its ‘key’ attribute.