I'm receiving data packets in XML format, each with a specific documentRoot tag, and I'd like to delegate specialized methods to take care of those packets, based on the root tag name. This worked with xml.dom.minidom, something like this:
dom = minidom.parseString(the_data)
root = dom.documentElement
deleg = getattr(self,'elem_' + str(root.tagName))
deleg(dom)
However, I want to simplify the things (in other parts of the code, not here) by using the more pythonic lxml.objectify.
The problem is I don't know how to get "root.tagName" with lxml, preferably strictly lxml.objectify. Any ideas?