pyroclast.objectHierarchies
index
c:\users\brian\projects\pyroclast\objecthierarchies.py

Handlers for data formats structured around an object hierarchy, as opposed
to a flat data table, such as JSON and XML

 
Modules
       
pyroclast.basic
json
re
xml.etree.ElementTree

 
Functions
       
formatJson(dicts, key='')
Converts a list of dictionaries into a JSON-formatted object hierarchy
that begins with a blank-keyed list of objects.
getJson(file, filters={})
Given a specific JSON file (string) and a set of filters (dictionary
key-values pairs), will return a JSON-formatted tree of the matching data
entries from that file (starting as a null-key list of objects).
getUnqlite(file, filters={})
Given a specific UnQLite file (string) and a set of filters (dictionary
key-values pairs), will return a JSON-formatted tree of the matching data
entries from that file (starting as a null-key list of objects).
Key-value pairs can be selected using the '_key' parameter, while
specific collections can be selected using the '_collection' parameter.
If neither parameter is used, all contents of the database are returned.
getXml(file, filters={})
Given a specific XML file (string) and a set of filters (dictionary
key-values pairs), will return a JSON-formatted tree of the matching data
entries from that file (starting as a null-key list of objects).
parseElement(el)
Recursively converts an XML element to a dictionary object. After the
initial pass, children are checked for single-value elements that are
duplicated as element attributes. Meta-attributes include:
   _tag, the tag name of the element
       _children, a list of dictionaries defining child elements
       _text, the parsed value of any element text content
All attribute and text values are parsed for boolean and numeric values.