Python MINIDOM Object How to get only the element name from DOM Object
Question: I have a python DOM object output, I need to get only the "Elements" from it.

Example:

    
    
    [<DOM Text node "u'\n\t\t\t'">, <DOM Element: StartTime at 0x397af30>, <DOM Text node "u'\n\t\t\t'">, <DOM Element: EndTime at 0x397afd0>, <DOM Text node "u'\n\t\t'">]
    

I need output like

    
    
    StartTime
    EndTime 
    

Can you please assist ? Thanks


Answer: > _"I have a python DOM object output, I need to get only the "Elements" from
> it."_

You can filter your list item where `nodeType ==
xml.dom.minidom.Node.ELEMENT_NODE`. For example, assuming that your _'DOM
object output'_ stored in a variable named `output`, you can do as follow :

    
    
    from xml.dom import minidom
    .....
    .....
    result = [item for item in output if item.nodeType == minidom.Node.ELEMENT_NODE]
    

