Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <root>
- <header>
- <ecode>0</ecode>
- <edesc/>
- </header>
- <body>
- <Prof>
- <nom>nombre</nom>
- <rut>rut</rut>
- <urlAg>url</urlAg>
- <fechTit>fecha</fechTit>
- <uni>universidad</uni>
- <EspeProf>
- <Esp>
- <nomEsp>especialidad 1</nomEsp>
- </Esp>
- </EspeProf>
- <CMProf>
- <CM>
- <nomCM>centro medico</nomCM>
- </CM>
- </CMProf>
- </Prof>
- <Prof>
- <nom>nombre</nom>
- <rut>rut</rut>
- <urlAg>url</urlAg>
- <fechTit>fecha </fechTit>
- <uni>universidad</uni>
- <EspeProf>
- <Esp>
- <nomEsp>especialidad 1</nomEsp>
- </Esp>
- <Esp>
- <nomEsp>especialidad 2</nomEsp>
- </Esp>
- </EspeProf>
- <CMProf>
- <CM>
- <nomCM>centro medico</nomCM>
- </CM>
- </CMProf>
- </Prof>
- </root>
- data = []
- try:
- if hasattr(ssl, '_create_unverified_context'):
- ssl._create_default_https_context = ssl._create_unverified_context
- url = '******'
- xml = urlopen(url)
- xml_string = xml.read()
- xml.close()
- xmldoc = minidom.parseString(xml_string)
- nombre=xmldoc.getElementsByTagName('nom')
- especialidad=xmldoc.getElementsByTagName('nomEsp').childNodes[0]
- for nom, esp in zip(nombre, especialidad):
- nombremedico=nom.firstChild.nodeValue
- especialidadmedico=esp.firstChild.data
- print(nombremedico)
- print(especialidadmedico)
- data.append({"name":nombremedico,"info":especialidadmedico})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement