Hi,

tjabaut wrote:
> I have an app where the API returns an XML state with a single element
> that contains a number of attributes (depending on which API is
> called).
> 
> I would like ot know how I can step through these Attributes so that I
> can populate an XHTML results page.

  # using Python 2.5
  from xml.etree import ElementTree
  tree = ElementTree.fromstring(the_xml_string)
  root = tree.getroot()

  # and now using the dict-like attrib property:
  for name, value in root.attrib.items():
      print name, value

Stefan
_______________________________________________
XML-SIG maillist  -  XML-SIG@python.org
http://mail.python.org/mailman/listinfo/xml-sig

Reply via email to