t.w.domhelpers : module documentation

Part of twisted.web View Source

A library for performing interesting tasks with DOM objects.
Class NodeLookupError Undocumented
Function substitute Look through the given node's children for strings, and attempt to do string substitution with the given parameter.
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 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 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 clearNode Remove all children from the given node.
Function locateNodes Find subnodes in the given node where the given attribute has the given value.
Function superSetAttribute Undocumented
Function superPrependAttribute Undocumented
Function superAppendAttribute Undocumented
Function gatherTextNodes No summary
Class RawText No summary
Function findNodes Undocumented
Function findNodesShallowOnMatch Undocumented
Function findNodesShallow Undocumented
Function findElementsWithAttributeShallow Return an iterable of the elements which are direct children of parent and which have the attribute attribute.
Function findElements Return an iterable of the elements which are children of parent for which the predicate matcher returns true.
Function findElementsWithAttribute Undocumented
Function findNodesNamed Undocumented
Function writeNodeData Undocumented
Function getNodeText Undocumented
Function getParents Undocumented
Function namedChildren namedChildren(parent, nodeName) -> children (not descendants) of parent that have tagName == nodeName
Function _get (internal) Get a node with the specified nodeId as any of the class, id or pattern attributes.
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 _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.
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 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 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 clearNode(node): (source)
Remove all children from the given node.
def locateNodes(nodeList, key, value, noNesting=1): (source)
Find subnodes in the given node where the given attribute has the given value.
def superSetAttribute(node, key, value): (source)
Undocumented
def superPrependAttribute(node, key, value): (source)
Undocumented
def superAppendAttribute(node, key, value): (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.

Returnsthe gathered nodes as a single string (type: str)
def findNodes(parent, matcher, accum=None): (source)
Undocumented
def findNodesShallowOnMatch(parent, matcher, recurseMatcher, accum=None): (source)
Undocumented
def findNodesShallow(parent, matcher, accum=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 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 findNodesNamed(parent, name): (source)
Undocumented
def writeNodeData(node, oldio): (source)
Undocumented
def getNodeText(node): (source)
Undocumented
def getParents(node): (source)
Undocumented
def namedChildren(parent, nodeName): (source)
namedChildren(parent, nodeName) -> children (not descendants) of parent that have tagName == nodeName
API Documentation for Twisted, generated by pydoctor at 2014-05-12 18:27:00.