Background: I'm coming from C#-land, so I'm looking for something like being able to handle nodes and values by selecting via Xpath.
Here's my code, so far:
import urllib
import sys
from xml.parsers import expat
url = 'http://SomeWebService.SomeDomain.com'
u = urllib.urlopen(url)
Parser = expat.ParserCreate()
data = u.read()
try:
Parser.Parse(data)
except:
print "ERROR: Can't parse the XML"
sys.exit(0)
What standard lib should I be using to deal with DOM elements as objects along with their attributes as one could in C#?
I'm looking for something like NodeList nodes = Parser.SelectNodes("Xpath")