splitting an XML file on the basis on basis of XML tags
bijeshn at gmail.com
bijeshn at gmail.com
Wed Apr 2 08:05:45 EDT 2008
Hi all,
i have an XML file with the following structure::
<r1>
<r2>-----|
<r3> |
<r4> |
. |
. | --------------------> constitutes one record.
. |
. |
. |
</r4> |
</r3> |
</r2>----|
<r2>
.
.
. -----------------------|
. |
. |
. |----------------------> there are n
records in between....
. |
. |
. |
. ------------------------|
.
.
</r2>
<r2>-----|
<r3> |
<r4> |
. |
. | --------------------> constitutes one record.
. |
. |
. |
</r4> |
</r3> |
</r2>----|
</r1>
Here <r1> is the main root tag of the XML, and <r2>...</r2>
constitutes one record. What I would like to do is
to extract everything (xml tags and data) between nth <r2> tag and (n
+k)th <r2> tag. The extracted data is to be
written down to a separate file.
Thanks...
More information about the Python-list
mailing list