| Home | Trees | Index | Help |
|
|---|
| Package bridge :: Class Element |
|
object --+
|
Element
Document| Method Summary | |
|---|---|
Maps an XML element to a Python object. | |
__copy__(self)
| |
deletes 'name' instance of Element. | |
__iter__(self)
| |
__repr__(self)
| |
__str__(self)
| |
__unicode__(self)
| |
clone(self)
| |
Collapses all content of this element and its entire subtree. | |
Applies a filter to this element. | |
deletes this instance of Element. | |
get_attribute(self,
name)
| |
get_attribute_ns(self,
name,
namespace)
| |
Returns the child element named 'name', None if not found. | |
Returns the all children of this element named 'name' | |
get_root(self)
| |
Checks if this element has a child named 'name' in its children elements | |
Checks if this element has 'name' attribute | |
Insert 'element' right after 'after_element'. | |
Insert 'element' right before 'before_element'. | |
Returns True if the direct children of this element makes are in mixed content. | |
Load source into an Element instance (Class method) | |
Updates prefixes of all the element of document matching (src, srcns) | |
Applies a validator on this element | |
Serializes as a string this element | |
| Inherited from object | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
| Property Summary | |
|---|---|
xml_root: Retrieve the top level element | |
| Class Variable Summary | |
|---|---|
NoneType |
as_attribute = None |
NoneType |
as_list = None |
str |
encoding = 'UTF-8'
|
| Instance Method Details |
|---|
__init__(self,
name=None,
content=None,
attributes=None,
prefix=None,
namespace=None,
parent=None)
|
__delattr__(self, name)deletes 'name' instance of Element. It will also removes it from its parent children and attributes.
|
collapse(self, separator='\n')Collapses all content of this element and its entire subtree. |
filtrate(self, some_filter, **kwargs)Applies a filter to this element. Returns what is returned from some_filter. Keyword arguments: some_filter -- a callable(**kwargs) |
forget(self)deletes this instance of Element. It will also removes it from its parent children and attributes. |
get_child(self, name, ns=None)Returns the child element named 'name', None if not found. Keyword arguments: name -- local name of the element ns -- namespace of the element |
get_children(self, name, ns=None, recursive=False)Returns the all children of this element named 'name' Keyword arguments: name -- local name of the element ns -- namespace of the element recursive -- if True this will iterate through the entire tree |
has_child(self, name, ns=None)Checks if this element has a child named 'name' in its children elements Keyword arguments: name -- local name of the element ns -- namespace of the element |
has_element(self, name, ns=None)Checks if this element has 'name' attribute Keyword arguments: name -- local name of the element ns -- namespace of the element |
insert_after(self, after_element, element)Insert 'element' right after 'after_element'. This only inserts the new element in self.xml_children Keyword arguments: after_element -- element pivot element -- new element to insert |
insert_before(self, before_element, element)Insert 'element' right before 'before_element'. This only inserts the new element in self.xml_children Keyword arguments: before_element -- element pivot element -- new element to insert |
is_mixed_content(self)Returns True if the direct children of this element makes are in mixed content. |
update_prefix(self, dst, srcns, dstns, update_attributes=True)Updates prefixes of all the element of document matching (src, srcns) Keyword arguments: dst -- new prefix to be used srcns -- source namespace dstns -- destination namespace update_attributes -- update attributes' namespace as well (default: True) |
validate(self, validator, **kwargs)Applies a validator on this element |
xml(self, indent=True, encoding='UTF-8', prefixes=None, omit_declaration=False, parser=None)Serializes as a string this element Keyword arguments indent -- pretty print the XML string (defaut: True) encoding -- encoding to use during the serialization process prefixes -- dictionnary of prefixes of the form {'prefix': 'ns'} omit_declaration -- prevent the result to start with the XML declaration parser -- instance of an existing parser, if not provided the default one will be used |
| Class Method Details |
|---|
load(self, source, prefixes=None, as_attribute=None, as_list=None, as_attribute_of_element=None, parser=None)Load source into an Element instance Keyword arguments: source -- an XML string, a file path or a file object prefixes -- dictionnary of prefixes of the form {'prefix': 'ns'} as_attribute -- dictionary of element names to set as attribute of their parent as_list -- dictionary of element names to set into a list of their parent as_attribute_of_element -- dictionary of attribute names to set as attribute of their parent If any of those last three parameters are provided they will take precedence over those set on the Element and Attribute class. |
| Property Details |
|---|
xml_rootRetrieve the top level element
|
| Class Variable Details |
|---|
as_attribute
|
as_list
|
encoding
|
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 2.1 on Tue May 22 18:09:00 2007 | http://epydoc.sf.net |