Package ptree :: Module elements :: Class _MultiParentedElement
[hide private]
[frames] | no frames]

classobj _MultiParentedElement

source code


A specialized version of etree.ElementTree.Element that keeps track of a list of parent pointers for each element.

Each _ParentedElement may have zero or more parents. In particular, subtrees may be shared. If a single _MultiParentedElement is used as multiple children of the same parent, then that parent will appear multiple times in the parents list.

_MultiParentedElements should never be used in the same tree as other Element implementation classes. Mixing Element implementations may result in incorrect parent pointers and in ValueError exceptions.

Instance Methods [hide private]
 
__init__(self, tag, attrib) source code
 
parents(self) source code
 
_setparent(self, element)
Update child's parent pointer to point to self.
source code
 
_delparent(self, element)
Remove self from child's parent pointer.
source code
 
makeelement(self, tag, attrib) source code

Inherited from _AbstractParentedElement: __delitem__, __delslice__, __repr__, __setitem__, __setslice__, append, extend, insert, pop, remove

Inherited from xml.etree.ElementTree._ElementInterface: __getitem__, __getslice__, __len__, clear, find, findall, findtext, get, getchildren, getiterator, items, keys, set

Class Variables [hide private]

Inherited from xml.etree.ElementTree._ElementInterface: attrib, tag, tail, text

Method Details [hide private]

__init__(self, tag, attrib)
(Constructor)

source code 
Overrides: xml.etree.ElementTree._ElementInterface.__init__

_setparent(self, element)

source code 

Update child's parent pointer to point to self.

Overrides: _AbstractParentedElement._setparent
(inherited documentation)

_delparent(self, element)

source code 

Remove self from child's parent pointer.

Overrides: _AbstractParentedElement._delparent
(inherited documentation)

makeelement(self, tag, attrib)

source code 
Overrides: xml.etree.ElementTree._ElementInterface.makeelement