module documentation

A library for performing interesting tasks with DOM objects.

This module is now deprecated.

Class RawText This is an evil and horrible speed hack. Basically, if you have a big chunk of XML that you want to insert into the DOM, but you don't want to incur the cost of parsing it, you can construct one of these and insert it into the DOM...
Exception NodeLookupError Undocumented
Function clearNode Remove all children from the given node.
Function findElements Return an iterable of the elements which are children of parent for which the predicate matcher returns true.
Function findElementsWithAttribute Undocumented
Function findElementsWithAttributeShallow Return an iterable of the elements which are direct children of parent and which have the attribute attribute.
Function findNodes Undocumented
Function findNodesNamed Undocumented
Function findNodesShallow Undocumented
Function findNodesShallowOnMatch Undocumented
Function gatherTextNodes Visit each child node and collect its text data, if any, into a string. For example:
Function get Get a node with the specified nodeId as any of the class, id or pattern attributes. If there is no such node, raise NodeLookupError.
Function getAndClear Get a node with the specified nodeId as any of the class, id or pattern attributes. If there is no such node, raise NodeLookupError. Remove all child nodes before returning.
Function getIfExists Get a node with the specified nodeId as any of the class, id or pattern attributes. If there is no such node, return None.
Function getNodeText Undocumented
Function getParents Undocumented
Function locateNodes Find subnodes in the given node where the given attribute has the given value.
Function namedChildren namedChildren(parent, nodeName) -> children (not descendants) of parent that have tagName == nodeName
Function substitute Look through the given node's children for strings, and attempt to do string substitution with the given parameter.
Function superAppendAttribute Undocumented
Function superPrependAttribute Undocumented
Function superSetAttribute Undocumented
Function writeNodeData Undocumented
Variable warningString Undocumented
Function _get (internal) Get a node with the specified nodeId as any of the class, id or pattern attributes.
def clearNode(node): (source)

Remove all children from the given node.

def findElements(parent, matcher): (source)

Return an iterable of the elements which are children of parent for which the predicate matcher returns true.

def findElementsWithAttribute(parent, attribute, value=None): (source)

Undocumented

def findElementsWithAttributeShallow(parent, attribute): (source)

Return an iterable of the elements which are direct children of parent and which have the attribute attribute.

def findNodes(parent, matcher, accum=None): (source)

Undocumented

def findNodesNamed(parent, name): (source)

Undocumented

def findNodesShallow(parent, matcher, accum=None): (source)

Undocumented

def findNodesShallowOnMatch(parent, matcher, recurseMatcher, accum=None): (source)

Undocumented

def gatherTextNodes(iNode, dounescape=0, joinWith=''): (source)

Visit each child node and collect its text data, if any, into a string. For example:

    >>> doc=microdom.parseString('<a>1<b>2<c>3</c>4</b></a>')
    >>> gatherTextNodes(doc.documentElement)
    '1234'

With dounescape=1, also convert entities back into normal characters.

Returns
strthe gathered nodes as a single string
def get(node, nodeId): (source)

Get a node with the specified nodeId as any of the class, id or pattern attributes. If there is no such node, raise NodeLookupError.

def getAndClear(node, nodeId): (source)

Get a node with the specified nodeId as any of the class, id or pattern attributes. If there is no such node, raise NodeLookupError. Remove all child nodes before returning.

def getIfExists(node, nodeId): (source)

Get a node with the specified nodeId as any of the class, id or pattern attributes. If there is no such node, return None.

def getNodeText(node): (source)

Undocumented

def getParents(node): (source)

Undocumented

def locateNodes(nodeList, key, value, noNesting=1): (source)

Find subnodes in the given node where the given attribute has the given value.

def namedChildren(parent, nodeName): (source)

namedChildren(parent, nodeName) -> children (not descendants) of parent that have tagName == nodeName

def substitute(request, node, subs): (source)

Look through the given node's children for strings, and attempt to do string substitution with the given parameter.

def superAppendAttribute(node, key, value): (source)

Undocumented

def superPrependAttribute(node, key, value): (source)

Undocumented

def superSetAttribute(node, key, value): (source)

Undocumented

def writeNodeData(node, oldio): (source)

Undocumented

warningString = (source)

Undocumented

def _get(node, nodeId, nodeAttrs=('id', 'class', 'model', 'pattern')): (source)

(internal) Get a node with the specified nodeId as any of the class, id or pattern attributes.