Thanks all for your help.<br><br>I decided to go with iterparse but trying the simple example in the python interpreter led to an error (see below) and when I tried this with a much larger xml sample, it seemed to print the full elements, not the specific values of the element. For example, given what I entered in the python interpreter, the result would have been the full xml example, and not &quot;Reminder&quot; &quot;Don&#39;t forget me this weekend&quot;. <br>
<br>Did I do something wrong in the sample below? Thanks again.<br><br>&gt;&gt;&gt; from xml.etree.cElementTree import iterparse<br>&gt;&gt;&gt; sample = &#39;&#39;&#39;\<br>... &lt;note&gt;<br>...     &lt;to&gt;Tove&lt;/to&gt;<br>
...     &lt;from&gt;Jani&lt;/from&gt;<br>...     &lt;heading&gt;Reminder&lt;/heading&gt;<br>...     &lt;body&gt;Don&#39;t forget me this weekend!&lt;/body&gt;<br>... &lt;/note&gt;<br>... &#39;&#39;&#39;<br>&gt;&gt;&gt; print sample<br>
&lt;note&gt;<br>    &lt;to&gt;Tove&lt;/to&gt;<br>    &lt;from&gt;Jani&lt;/from&gt;<br>    &lt;heading&gt;Reminder&lt;/heading&gt;<br>    &lt;body&gt;Don&#39;t forget me this weekend!&lt;/body&gt;<br>&lt;/note&gt;<br><br>&gt;&gt;&gt; for event, elem in iterparse(sample):<br>
...     if elem.tag == &#39;note&#39;:<br>...             print elem.findtext(&#39;heading&#39;), elem.findtext(&#39;body&#39;)<br>...             elem.clear()<br>...<br>... <br>Traceback (most recent call last):<br>  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>
  File &quot;&lt;string&gt;&quot;, line 52, in __init__<br>IOError: [Errno 2] No such file or directory: &quot;&lt;note&gt;\n\t&lt;to&gt;Tove&lt;/to&gt;\n\t&lt;from&gt;Jani&lt;/from&gt;\n\t&lt;heading&gt;Reminder&lt;/heading&gt;\n\t&lt;body&gt;Don&#39;t forget me this weekend!&lt;/body&gt;\n&lt;/note&gt;\n&quot;<br>
&gt;&gt;&gt; <br><br><br><div class="gmail_quote">On Sun, Jun 20, 2010 at 4:32 AM, Stefan Behnel <span dir="ltr">&lt;<a href="mailto:stefan_ml@behnel.de">stefan_ml@behnel.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
please don&#39;t top-post, it makes your replies hard to read in context.<br>
<br>
Karim, 20.06.2010 10:24:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
On 06/20/2010 10:14 AM, Stefan Behnel wrote:<br>
</div><div class="im"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Use ElementTree&#39;s iterparse:<br>
<br>
from xml.etree.cElementTree import iterparse<br>
</blockquote></div></blockquote>
&gt;&gt; [...]<div class="im"><br>
&gt;<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I know you are promoting Etree and I am very interesting in it.<br>
Is there any chance to have it integrated in future standard Python<br>
version?<br>
</blockquote>
<br></div>
The import above comes directly from the standard library (Python 2.5 and later). You may be referring to lxml.etree, which will most likely never make it into the stdlib.<div><div></div><div class="h5"><br>
<br>
Stefan<br>
<br>
_______________________________________________<br>
Tutor maillist  -  <a href="mailto:Tutor@python.org" target="_blank">Tutor@python.org</a><br>
To unsubscribe or change subscription options:<br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
</div></div></blockquote></div><br>