In [1]:
url = 'http://lmsal.com/hek/hcr?cmd=get-voevent-xml&event-id=ivo%3A%2F%2Firis.lmsal.com%2FVOEvent%232014-08-11T11%3A48%3A50Z'

In [2]:
import xml.etree.ElementTree as ET
import urllib2

In [3]:
req = urllib2.Request(url)
r = urllib2.urlopen(req)

In [4]:
for line in r:
    print(line)


<?xml version="1.0" encoding="UTF-8" ?>

<VOEvent role="prediction"

	ivorn="ivo://iris.lmsal.com/VOEvent#2014-08-11T11:48:50Z"

	version="1.11"

	xmlns="http://www.ivoa.net/xml/VOEvent/v1.11"

	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

	xmlns:lmsal="http://sot.lmsal.com/lmsal"

	xmlns:crd="urn:nvo-coords"

	xsi:schemaLocation="http://www.ivoa.net/internal/IVOA/IvoaVOEvent/VOEvent-v1.0.xsd">





	<Who>

		<!-- Data pertaining to curation: observer, telescope, instrument, planner, tohbans, ... -->

		<Date>2014-08-08T22:39:00.000Z</Date>    <!-- Time VOEvent was generated. -->

		<PublisherID>http://sot.lmsal.com</PublisherID>



		<Contact>

			<Name>Ted Tarbell</Name>

			<Institution>LMSAL</Institution>

			<Communication>

				<Uri>http://lmsal.com</Uri>

				<AddressLine>3251 Hanover Rd, O/ADBS, B/252, Palo Alto, CA, 94304</AddressLine>

				<Telephone>+1-650-424-2400</Telephone>

				<Email>tarbell@lmsal.com</Email>

			</Communication>		</Contact>



		<lmsal:Telescope>IRIS</lmsal:Telescope>

		<lmsal:Instrument>IRIS</lmsal:Instrument>

		<lmsal:Tohbans>null</lmsal:Tohbans>

		<lmsal:ChiefPlanner>Ted Tarbell</lmsal:ChiefPlanner>

		<lmsal:ChiefObserver>Ted Tarbell</lmsal:ChiefObserver>

	</Who>





	<What>

		<!-- Data pertaining to what was observed, measured, ...   Some of these tags might move into Who section. -->

		<lmsal:obsId>3800011454</lmsal:obsId>

		<lmsal:OBS_NUM>3800011454</lmsal:OBS_NUM>

		<lmsal:JOP_ID></lmsal:JOP_ID>

		<lmsal:JOP></lmsal:JOP>

		<lmsal:JOIN_SB>null</lmsal:JOIN_SB>    <!-- S=SOT, X=XRT, E=EIS, SX=SOT+XRT, EX=EIS+XRT -->

		<lmsal:OBSTITLE>AR 12135 SNS on umbra with SOT</lmsal:OBSTITLE>

		<lmsal:SCI_OBJ>AR 12135 SNS on umbra with SOT</lmsal:SCI_OBJ>     <!--  Scientific objectives -->

		<lmsal:SCI_OBS></lmsal:SCI_OBS>     <!-- Objects being observed -->

		<lmsal:NOAA_NUM></lmsal:NOAA_NUM>

		<lmsal:TARGET>SS</lmsal:TARGET>

		<lmsal:slotNumber></lmsal:slotNumber>

	</What>





	<WhereWhen>

		<!-- Space and Time Coordinates. -->

		<ObservatoryLocation ID="IRIS" />



		<ObservationLocation>

			<lmsal:xCen>-29</lmsal:xCen>		<!-- xcen and ycen from FITS -->

			<lmsal:yCen>124</lmsal:yCen>

			<lmsal:rollAngleDegrees>0</lmsal:rollAngleDegrees>

			<lmsal:xFov>0</lmsal:xFov>

			<lmsal:yFov>173.8</lmsal:yFov>

			<crd:AstroCoords coord_system_id="UTC-HGS-TOPO">

				<crd:Time>

					<crd:TimeInterval>2014-08-11T11:48:50.000Z 2014-08-11T13:00:41.000Z</crd:TimeInterval>

				</crd:Time>

				<crd:Position3D>-29 124</crd:Position3D>

			</crd:AstroCoords>

		</ObservationLocation>



		<Group name="hlIntervals">

			<Param name="hlInterval" value="2014-08-11T12:52:02Z 2014-08-11T12:58:26" />

		</Group>

	</WhereWhen>





	<Why>

		<!-- Why was observation performed.  Initial scientific assessment, hypothesized mechanisms, classifications, ... -->

		<Concept>

			<lmsal:Goal>Very large sit-and-stare 0.3x175 1s  Si IV   Mg II h/k Deep x 15</lmsal:Goal>

			<lmsal:Purpose>AR 12135 SNS on umbra with SOT</lmsal:Purpose>

		</Concept>



		<Description>

			AR 12135 SNS on umbra with SOT

128 repeats of OBSID 3800011454  -  Very large sit-and-stare 0.3x175 1s  Si IV   Mg II h/k Deep x 15

IRIS roll: 0.0 degrees

IRIS planner pointing: (-29.0 arcsec, 124.0 arcsec)

OBS duration: 4311.0 seconds = 128 repeats x 33.7 seconds/repeat

OBS data volume: 652.0 megabytes = 5216.4 megabits = 4311.0 seconds * 1.2 megabits/second

		</Description>

	</Why>



</VOEvent>


In [7]:
tree = ET.parse(r)
root = tree.getroot()


  File "<string>", line unknown
ParseError: no element found: line 1, column 0

In [6]:
root.tag


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-6-629370b52c19> in <module>()
----> 1 root.tag

NameError: name 'root' is not defined

In [9]:
for child in root:
    print child.tag, child.attrib
    for country in root.findall(child.tag):
        print country.find('Contact')
        
        #rank = country.find('rank').text
        #name = country.get('name')
        #print name, rank


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-9-0671028465a8> in <module>()
----> 1 for child in root:
      2     print child.tag, child.attrib
      3     for country in root.findall(child.tag):
      4         print country.find('Contact')
      5 

NameError: name 'root' is not defined

In [8]:
for elem in tree.iter():
    print elem.tag, elem.attrib, elem.text


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-8-c52eeda24989> in <module>()
----> 1 for elem in tree.iter():
      2     print elem.tag, elem.attrib, elem.text

NameError: name 'tree' is not defined

In [ ]: