BigBrotherBot v1.8.0
System Development Information for the BigBrotherBot project.

b3::lib::elementtree::ElementTree::_ElementInterface Class Reference

Internal element class. More...

List of all members.

Public Member Functions

def __init__
def __repr__
def makeelement
 Creates a new element object of the same type as this element.
def __len__
 Returns the number of subelements.
def __getitem__
 Returns the given subelement.
def __setitem__
 Replaces the given subelement.
def __delitem__
 Deletes the given subelement.
def __getslice__
 Returns a list containing subelements in the given range.
def __setslice__
 Replaces a number of subelements with elements from a sequence.
def __delslice__
 Deletes a number of subelements.
def append
 Adds a subelement to the end of this element.
def insert
 Inserts a subelement at the given position in this element.
def remove
 Removes a matching subelement.
def getchildren
 Returns all subelements.
def find
 Finds the first matching subelement, by tag name or path.
def findtext
 Finds text for the first matching subelement, by tag name or path.
def findall
 Finds all matching subelements, by tag name or path.
def clear
 Resets an element.
def get
 Gets an element attribute.
def set
 Sets an element attribute.
def keys
 Gets a list of attribute names.
def items
 Gets element attributes, as a sequence.
def getiterator
 Creates a tree iterator.

Static Public Attributes

 tag = None
 (Attribute) Element tag.
 attrib = None
 (Attribute) Element attribute dictionary.
 text = None
 (Attribute) Text before first subelement.
 tail = None
 (Attribute) Text after this element's end tag, but before the next sibling element's start tag.

Private Attributes

 _children

Detailed Description

Internal element class.

This class defines the Element interface, and provides a reference implementation of this interface.

You should not create instances of this class directly. Use the appropriate factory functions instead, such as Element and SubElement.

See also:
Element
SubElement
Comment
ProcessingInstruction

Constructor & Destructor Documentation

def b3::lib::elementtree::ElementTree::_ElementInterface::__init__ (   self,
  tag,
  attrib 
)

Member Function Documentation

def b3::lib::elementtree::ElementTree::_ElementInterface::__delitem__ (   self,
  index 
)

Deletes the given subelement.

Parameters:
indexWhat subelement to delete.
Exceptions:
IndexErrorIf the given element does not exist.
def b3::lib::elementtree::ElementTree::_ElementInterface::__delslice__ (   self,
  start,
  stop 
)

Deletes a number of subelements.

Parameters:
startThe first subelement to delete.
stopThe first subelement to leave in there.
def b3::lib::elementtree::ElementTree::_ElementInterface::__getitem__ (   self,
  index 
)

Returns the given subelement.

Parameters:
indexWhat subelement to return.
Returns:
The given subelement.
Exceptions:
IndexErrorIf the given element does not exist.
def b3::lib::elementtree::ElementTree::_ElementInterface::__getslice__ (   self,
  start,
  stop 
)

Returns a list containing subelements in the given range.

Parameters:
startThe first subelement to return.
stopThe first subelement that shouldn't be returned.
Returns:
A sequence object containing subelements.
def b3::lib::elementtree::ElementTree::_ElementInterface::__len__ (   self)

Returns the number of subelements.

Returns:
The number of subelements.
def b3::lib::elementtree::ElementTree::_ElementInterface::__repr__ (   self)
def b3::lib::elementtree::ElementTree::_ElementInterface::__setitem__ (   self,
  index,
  element 
)

Replaces the given subelement.

Parameters:
indexWhat subelement to replace.
elementThe new element value.
Exceptions:
IndexErrorIf the given element does not exist.
AssertionErrorIf element is not a valid object.
def b3::lib::elementtree::ElementTree::_ElementInterface::__setslice__ (   self,
  start,
  stop,
  elements 
)

Replaces a number of subelements with elements from a sequence.

Parameters:
startThe first subelement to replace.
stopThe first subelement that shouldn't be replaced.
elementsA sequence object with zero or more elements.
Exceptions:
AssertionErrorIf a sequence member is not a valid object.
def b3::lib::elementtree::ElementTree::_ElementInterface::append (   self,
  element 
)

Adds a subelement to the end of this element.

Parameters:
elementThe element to add.
Exceptions:
AssertionErrorIf a sequence member is not a valid object.
def b3::lib::elementtree::ElementTree::_ElementInterface::clear (   self)

Resets an element.

This function removes all subelements, clears all attributes, and sets the text and tail attributes to None.

def b3::lib::elementtree::ElementTree::_ElementInterface::find (   self,
  path 
)

Finds the first matching subelement, by tag name or path.

Parameters:
pathWhat element to look for.
Returns:
The first matching element, or None if no element was found. Element or None
def b3::lib::elementtree::ElementTree::_ElementInterface::findall (   self,
  path 
)

Finds all matching subelements, by tag name or path.

Parameters:
pathWhat element to look for.
Returns:
A list or iterator containing all matching elements, in document order. list of Element instances
def b3::lib::elementtree::ElementTree::_ElementInterface::findtext (   self,
  path,
  default = None 
)

Finds text for the first matching subelement, by tag name or path.

Parameters:
pathWhat element to look for.
defaultWhat to return if the element was not found.
Returns:
The text content of the first matching element, or the default value no element was found. Note that if the element has is found, but has no text content, this method returns an empty string. string
def b3::lib::elementtree::ElementTree::_ElementInterface::get (   self,
  key,
  default = None 
)

Gets an element attribute.

Parameters:
keyWhat attribute to look for.
defaultWhat to return if the attribute was not found.
Returns:
The attribute value, or the default value, if the attribute was not found. string or None
def b3::lib::elementtree::ElementTree::_ElementInterface::getchildren (   self)

Returns all subelements.

The elements are returned in document order.

Returns:
A list of subelements. list of Element instances
def b3::lib::elementtree::ElementTree::_ElementInterface::getiterator (   self,
  tag = None 
)

Creates a tree iterator.

The iterator loops over this element and all subelements, in document order, and returns all elements with a matching tag.

If the tree structure is modified during iteration, the result is undefined.

Parameters:
tagWhat tags to look for (default is to return all elements).
Returns:
A list or iterator containing all the matching elements. list or iterator
def b3::lib::elementtree::ElementTree::_ElementInterface::insert (   self,
  index,
  element 
)

Inserts a subelement at the given position in this element.

Parameters:
indexWhere to insert the new subelement.
Exceptions:
AssertionErrorIf the element is not a valid object.
def b3::lib::elementtree::ElementTree::_ElementInterface::items (   self)

Gets element attributes, as a sequence.

The attributes are returned in an arbitrary order.

Returns:
A list of (name, value) tuples for all attributes. list of (string, string) tuples
def b3::lib::elementtree::ElementTree::_ElementInterface::keys (   self)

Gets a list of attribute names.

The names are returned in an arbitrary order (just like for an ordinary Python dictionary).

Returns:
A list of element attribute names. list of strings
def b3::lib::elementtree::ElementTree::_ElementInterface::makeelement (   self,
  tag,
  attrib 
)

Creates a new element object of the same type as this element.

Parameters:
tagElement tag.
attribElement attributes, given as a dictionary.
Returns:
A new element instance.
def b3::lib::elementtree::ElementTree::_ElementInterface::remove (   self,
  element 
)

Removes a matching subelement.

Unlike the find methods, this method compares elements based on identity, not on tag value or contents.

Parameters:
elementWhat element to remove.
Exceptions:
ValueErrorIf a matching element could not be found.
AssertionErrorIf the element is not a valid object.
def b3::lib::elementtree::ElementTree::_ElementInterface::set (   self,
  key,
  value 
)

Sets an element attribute.

Parameters:
keyWhat attribute to set.
valueThe attribute value.

Member Data Documentation

(Attribute) Element attribute dictionary.

Where possible, use _ElementInterface.get, _ElementInterface.set, _ElementInterface.keys, and _ElementInterface.items to access element attributes.

(Attribute) Element tag.

(Attribute) Text after this element's end tag, but before the next sibling element's start tag.

This is either a string or the value None, if there was no text.

(Attribute) Text before first subelement.

This is either a string or the value None, if there was no text.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Properties