So as far as I understood what I should do is the following.
Go through my own XML keeping track of the full path of everything for
example

<SETUP>
<SETUP/COMMENT>
<SETUP/OTHER>

and so on, then for every entry found in this iteration, check the schema
to make sure that that particular construct is allowed
on that level of the tree.

I have something like this for example that creates a dictionary from an
element tree element...
Does it make sense or am I going in the wrong direction?


def etree_to_dict(xml_file):
    """Takes the root node from the XML and generates a dictionary
    """
    dic = {}
    etree = ElementTree.parse(open(xml_file))
    root = list(etree.iter())[0]
    queue = [root]

    while queue:
        el = queue.pop()
        childs = el.getchildren()
        queue += childs
        dic[el] = childs

    return dic
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to