Is it possible to auto-generate python class objects based on the hierarchical content of an XML file?
Let me explain a little what I mean. Suppose I have an XML file containing (for simplicity) the following:
<breakfast_menu> <food> <name>Belgian Waffles</name> <price>$5.95</price> <description>blah blah...etc...</description> <calories>650</calories> </food> </breakfast_menu>
I like the way XML represents data and attributes, but I would like to use Python, so I ask if there are a set of utilities that read the above file and create something like:
class breakfast_menu(): food = food(self, name="Belgian Waffles", price="$5.95", description="blah blah...etc...", calories=650)
Is it possible? Can anyone suggest a way / tool for this? Thank you in advance for your consideration.
source share