Parsing XML documents with LXML I'm new to LXML, and parsing XML documents in general. I have written a small section of code that appears to do what I need it too do, but it feels like I have overly complicated it. Is there any way I can simplify this?

Method:

def importFromXML(self, filename):
    tree = etree.parse(filename)
    for child in tree.getroot():
        if child.tag != 'SLOT':
            print('Tag:', child.tag, ', Text', child.text)
        elif child.tag == 'SLOT':
            for slot, index in child.items():
                for attribute in child:
                    print('Slot Number =', index, ', Tag:', attribute.tag, ', Value:', attribute.text)


XML:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;Item&gt;
&lt;ActiveState&gt;drop&lt;/ActiveState&gt;
&lt;Location&gt;Left Wrist&lt;/Location&gt;
&lt;Realm&gt;All&lt;/Realm&gt;
&lt;ItemName&gt;Band of the Dream Conqueror&lt;/ItemName&gt;
&lt;ItemQuality&gt;100&lt;/ItemQuality&gt;
&lt;Equipped&gt;1&lt;/Equipped&gt;
&lt;Level&gt;50&lt;/Level&gt;
&lt;TYPE&gt;Wrist&lt;/TYPE&gt;
&lt;SOURCE&gt;Drop&lt;/SOURCE&gt;
&lt;DBSOURCE&gt;kscraft&lt;/DBSOURCE&gt;
&lt;SLOT Number="0"&gt;
    &lt;Type&gt;Resist&lt;/Type&gt;
    &lt;Effect&gt;Crush&lt;/Effect&gt;
    &lt;Amount&gt;6&lt;/Amount&gt;
&lt;/SLOT&gt;
&lt;SLOT Number="1"&gt;
    &lt;Type&gt;Resist&lt;/Type&gt;
    &lt;Effect&gt;Thrust&lt;/Effect&gt;
    &lt;Amount&gt;6&lt;/Amount&gt;
&lt;/SLOT&gt;
&lt;SLOT Number="2"&gt;
    &lt;Type&gt;Resist&lt;/Type&gt;
    &lt;Effect&gt;Slash&lt;/Effect&gt;
    &lt;Amount&gt;6&lt;/Amount&gt;
&lt;/SLOT&gt;
&lt;/Item&gt;


I just want to make sure I'm doing this right. I'm using Python 3.x. Eventually I will be doing more with the data I pull, but for right now I'm just trying to pull the information, and figure out the most optimized way of doing this.
The code isn't actually doing much, there's little to review to be honest, it's not looking complicated for what it is.  Of course don't just have everything in a couple of loops, perhaps have some handlers to dispatch on the tags or so (handlers[child.tag](child) ...).

I suppose if you wanted a relatively quick way to write the importer code, consider XPath.  If you wanted quick processing (by not building up the full DOM in memory), consider using a SAX handler.

Finally, there might be a library to automatically map the XML to a class structure, or even parse it directly into dict instances or something, if you prefer that, but I don't any off the top of my hat.