Package deefuzzer :: Package deefuzzer :: Package tools :: Module xmltodict2
[hide private]
[frames] | no frames]

Module xmltodict2

source code

xmltodict(): convert xml into tree of Python dicts.

This was copied and modified from John Bair's recipe at aspn.activestate.com:
        http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/149368

Classes [hide private]
  Xml2Obj
XML to Object
Functions [hide private]
 
xmltodict(xml, attsToSkip=[], addCodeFile=False)
Given an xml string or file, return a Python dictionary.
source code
 
escQuote(val, noEscape=False, noQuote=False)
Add surrounding quotes to the string, and escape any illegal XML characters.
source code
 
dicttoxml(dct, level=0, header=None, linesep=None)
Given a Python dictionary, return an xml string.
source code
 
flattenClassDict(cd, retDict=None)
Given a dict containing a series of nested objects such as would be created by restoring from a cdxml file, returns a dict with all classIDs as keys, and a dict as the corresponding value.
source code
 
addInheritedInfo(src, super, updateCode=False)
Called recursively on the class container structure, modifying the attributes to incorporate superclass information.
source code
Variables [hide private]
  code_linesep = "\n"
  eol = os.linesep
Function Details [hide private]

dicttoxml(dct, level=0, header=None, linesep=None)

source code 

Given a Python dictionary, return an xml string.

The dictionary must be in the format returned by dicttoxml(), with keys on "attributes", "code", "cdata", "name", and "children".

Send your own XML header, otherwise a default one will be used.

The linesep argument is a dictionary, with keys on levels, allowing the developer to add extra whitespace depending on the level.

flattenClassDict(cd, retDict=None)

source code 

Given a dict containing a series of nested objects such as would be created by restoring from a cdxml file, returns a dict with all classIDs as keys, and a dict as the corresponding value. The dict value will have keys for the attributes and/or code, depending on what was in the original dict. The end result is to take a nested dict structure and return a flattened dict with all objects at the top level.

addInheritedInfo(src, super, updateCode=False)

source code 

Called recursively on the class container structure, modifying the attributes to incorporate superclass information. When the 'updateCode' parameter is True, superclass code is added to the object's code