Doran, Harold wrote:
>    for statentityref in statentityref.findall('statentityref'):

In this line, you assign new values to the name "statentityref" in each
iteration of the loop.

>       for statval in statentityref.findall('statval'):
>          print >> f, statentityref.attrib['id'], '\t',

Here, you access the attribute "id" of the element you referenced by that
name, which is different in each iteration. But only the first element
seems to have a meaningful value for this attribute.

You should

a) read the Python tutorial, especially the chapter on loops, and
b) assign the value of the "id" attribute to a variable outside the loop
and print it inside the loop

Stefan

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

Reply via email to