Objectify¶
objectify
Objectify¶
-
pyspreedly.objectify.
objectify_spreedly
(xml)[source]¶ Does some high level stuff to the XML tree, and then passes it off to
parse_element()
to get the data back as a dictionary. Truth be told it is not really objectifying spreedly, but turning it into a dictionary.Parameters: xml – xml string or file object. If it is a string, it is turned into StringIO
.
-
pyspreedly.objectify.
parse_element
(element)[source]¶ Recursivly parses an element of the xml node depth first. Turns all xml tags to underscore instead of dashes. Handles all types in _types (string, integer datetime, decimal, boolean, array). Every other type is treated as a string. There are some damn odd types in the data passed. Warning - this doesn’t check that the data is what it should be, or that stuff is not being added.
Parameters: element – ElementTree
element.Returns: dictionary of the data (unordered but with correct heirarchy). Raises: MaximumRecursionDepthExceeded
if you do pass some crazy huge and deap XML tree