Package gmisclib :: Module xmlmisc
[frames] | no frames]

Module xmlmisc

source code

This contains helper functions and classes for processing XML, based on the ElementTree module.

Classes
  loc_finder
A class for specifying a path through an XML tree to a particular node.
Functions
iterator(list(str))
treestructures(elt)
This gives you a view of what the XML hierarchy looks like.
source code
 
test_loc_finder() source code
 
test() source code
Variables
  __package__ = 'gmisclib'

Imports: elTree


Function Details

treestructures(elt)

source code 

This gives you a view of what the XML hierarchy looks like. It's intended to help you deduce the correct DTD, or just to understand how the data is arranged. It shows you the kinds of leaf tags you have and the kinds of paths through the XML tree necessary to get to each leaf.

Parameters:
  • elt (an xml.etree.cElementTree Element) - an XML tree structure
Returns: iterator(list(str))
a sequence of embedding lists. Each embedding list contains the tags you go through en route to a leaf node. So, <a> <b> <c>x</c> </b> </a> would yield a list ['a', 'b', 'c'] and <a> <b>x</b> <c> y </c> </a> would yield ['a', 'b'] and ['a', 'c'].