Package lib :: Module xml
[hide private]
[frames] | no frames]

Module xml

source code

Module containing generic functions for creation and parsing of XML representations of Python objects.

Functions [hide private]
 
fill_object_contents(doc, elem, object=None, blacklist=[])
Place all simple python objects into the XML element namespace.
source code
 
node_value_to_python(elem)
Convert the node value to a python expression.
source code
 
object_to_xml(doc, elem, value=None)
Convert the given value into an XML form.
source code
 
xml_to_object(elem, base_object=None, set_fn=None, file_version=1, blacklist=[])
Convert the XML elements into python objects, and place these into the base object.
source code
Variables [hide private]
  __package__ = 'lib'

Imports: numpy, set_printoptions, array, int16, int32, float32, float64, inf, ndarray, zeros, search, lib, unicode, floatAsByteArray, packBytesAsPyFloat, RelaxError


Function Details [hide private]

fill_object_contents(doc, elem, object=None, blacklist=[])

source code 

Place all simple python objects into the XML element namespace.

Parameters:
  • doc (xml.dom.minidom.Document instance) - The XML document object.
  • elem (XML element object) - The element to add all python objects to.
  • object (instance) - The python class instance containing the objects to add.
  • blacklist (list of str) - A list of object names to exclude.

node_value_to_python(elem)

source code 

Convert the node value to a python expression.

Parameters:
  • elem (xml.dom.minidom.Element instance) - The XML element.

object_to_xml(doc, elem, value=None)

source code 

Convert the given value into an XML form.

Parameters:
  • doc (xml.dom.minidom.Document instance) - The XML document object.
  • elem (XML element object) - The element to add the Python objects to.
  • value (anything) - The Python object to convert.

xml_to_object(elem, base_object=None, set_fn=None, file_version=1, blacklist=[])

source code 

Convert the XML elements into python objects, and place these into the base object.

Parameters:
  • elem (xml.dom.minidom.Element instance) - The element to extract all python objects from.
  • base_object (instance) - The python class instance to place the objects into.
  • set_fn (function) - A function used to replace setattr for placing the object into the base object.
  • file_version (int) - The relax XML version of the XML file.
  • blacklist (list of str) - A list of object names to exclude.