Python XML parsing from website

from xml.dom import minidom import urllib2 response = urllib2.urlopen('http://10.121.6.38/ejemplo.xml') html = response.read() xmldoc = minidom.parseString(html) nodos = xmldoc.childNodes print(nodos[0]) itemlist = xmldoc.getElementsByTagName('persona') print len(itemlist) for s in itemlist : fichas = s.getElementsByTagName('ficha') len(fichas)
Leer y parsear un archivo XML que reside en un sitio web con python

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.