Package translate :: Package misc :: Module ourdom
[hide private]
[frames] | no frames]

Module ourdom

source code

module that provides modified DOM functionality for our needs

Note that users of ourdom should ensure that no code might still use classes directly from minidom, like minidom.Element, minidom.Document or methods such as minidom.parseString, since the functionality provided here will not be in those objects.

Classes [hide private]
  DOMImplementation
  Element
  Document
  ExpatBuilderNS
Functions [hide private]
 
writexml_helper(self, writer, indent='', addindent='', newl='')
A replacement for writexml that formats it like typical XML files.
source code
 
getElementsByTagName_helper(parent, name, dummy=None)
A reimplementation of getElementsByTagName as an iterator.
source code
 
searchElementsByTagName_helper(parent, name, onlysearch)
limits the search to within tags occuring in onlysearch
source code
 
getFirstElementByTagName(node, name) source code
 
getnodetext(node)
returns the node's text by iterating through the child nodes
source code
 
parse(file, parser=None, bufsize=None)
Parse a file into a DOM by filename or file object.
source code
 
parseString(string, parser=None)
Parse a file into a DOM from a string.
source code
Variables [hide private]
  theDOMImplementation = DOMImplementation()

Imports: minidom, expatbuilder


Function Details [hide private]

writexml_helper(self, writer, indent='', addindent='', newl='')

source code 

A replacement for writexml that formats it like typical XML files. Nodes are intendented but text nodes, where whitespace can be significant, are not indented.

getElementsByTagName_helper(parent, name, dummy=None)

source code 

A reimplementation of getElementsByTagName as an iterator.

Note that this is not compatible with getElementsByTagName that returns a list, therefore, the class below exposes this through yieldElementsByTagName