How to create proper xml attribute with python parser
Question: 
    from xml.dom.minidom import parse
    
    dom = parse('abc.xml')
    
    for node in dom.getElementsBy('addr'): 
        print node.toxml()  
    

What do i need to add (attribute) to print only addr's ( ip addresses from
nmap xml file) ?

    
    
    <host starttime="1404053959" endtime="1404054014"><status state="up" reason="reset" reason_ttl="254"/> <address addr="ip" addrtype="ipv4"/>
    


Answer: I add `root` tag and `127.0.0.1`, `192.168.0.1` to show something more:

    
    
    from xml.dom.minidom import parse, parseString
    
    data = '''<root>
    <host starttime="1404053959" endtime="1404054014">
        <status state="up" reason="reset" reason_ttl="254"/>
        <address addr="ip" addrtype="ipv4">127.0.0.1</address>
    </host>
    <host starttime="1404053959" endtime="1404054014">
        <status state="up" reason="reset" reason_ttl="254"/>
        <address addr="ip" addrtype="ipv4">192.168.0.1</address>
    </host>
    </root>'''
    
    #dom = parse('abc.xml')
    dom = parseString(data)
    
    for node in dom.getElementsByTagName('address'):
        print ' xml:', node.toxml()
        print 'type:', node.getAttribute('addrtype')
        print 'addr:', node.childNodes[0].data
    

result:

    
    
     xml: <address addr="ip" addrtype="ipv4">127.0.0.1</address>
    type: ipv4
    addr: 127.0.0.1
     xml: <address addr="ip" addrtype="ipv4">192.168.0.1</address>
    type: ipv4
    addr: 192.168.0.1
    

