4Suite API Documentation

Module amara.domtools

# -*- coding: iso-8859-1 -*- #Required in Python 2.2, and must be the first import
Functions:
Globals:

Functions

abs_path(node, prefixes=None)
Return an XPath expression that provides a unique path to the given node (supports elements, attributes, root nodes, text nodes, comments and PIs) within a document
prefixes - optional hint dictionary from prefix to namespace
           if the document uses the default namespace, this function
           might need to come up with a prefix for the QName for certain
           nodes.  You can help control such prefix selection by passing in
           this dictionary.  Prefixes found in this dictionary will
           be used to reconcile default namespace usage
           WARNING: this value may be mutated by this function--key/value
           pairs might be added to the dictionary
doc_order_iter(node)
Iterates over each node in document order, yielding each in turn, starting with the given node node - the starting point (subtree rooted at node will be iterated over document order)
doc_order_iter_filter(node, filter_func)
Iterates over each node in document order, applying the filter function to each in turn, starting with the given node, and yielding each node in cases where the filter function computes true node - the starting point (subtree rooted at node will be iterated over document order) filter_func - a callable object taking a node and returning true or false
get_elements_by_tag_name(node, name)
Returns an iterator (in document order) over all the element nodes that are descendants of the given one, and have the given tag name. y node will be returned if it has the right name name - the node name to check
get_elements_by_tag_name_ns(node, ns, local)
Returns an iterator (in document order) over all the element nodes that are descendants of the given one, and have the given namespace and local name. node - the starting point (subtree rooted at node will be searched) node will be returned if it has the right ns and local name ns - the namespace to check local - the local name to check
get_first_element_by_tag_name_ns(node, ns, local)
Returns the first element in document order with the given namespace and local name node - the starting point (subtree rooted at node will be searched) node will be returned if it has the right ns and local name ns - the namespace to check local - the local name to check
get_leaf_elements(node)
Return a list of elements that have no element children node - the starting point (subtree rooted at node will be searched)
pushdom(source, xpatterns, prefixes=None)
rename_element(elem, new_ns, new_qname)
string_value(node)
Return the XPath string value of the given node This basically consists of one string comprising all the character data in the node and its descendants node - the starting point
text_search(node, sought)
Return a list of descendant elements which contain a given substring in their text node - the starting point (subtree rooted at node will be searched) sought - the substring to find

Globals

DEFAULT_GENERATED_PREFIX = u'amara.4suite.org.ns%i'
OTHER_NODES = {3: 'text', 7: 'processing-instruction', 8: 'comment'}
generators = _Feature((2, 2, 0, 'alpha', 1), (2, 3, 0, 'final', 0), 0)