[Tutor] Read XML records one by one
Stefan Behnel
stefan_ml at behnel.de
Mon Mar 8 11:44:38 CET 2010
Hichiro, 08.03.2010 10:48:
> I'm trying to read one by one record in XML file to find out its tag and
> attribute for schema matching. But I haven't done yet. So, could you help
> me?!
You were not very specific about your data, neither did you provide enough
information about your use case to understand what you want to achieve.
Therefore, I can't give you a real solution. Here's one you can adapt:
import xml.etree.ElementTree as ET
for _, element in ET.iterparse("the_file.xml"):
print element.tag, element.attrib
Stefan
More information about the Tutor
mailing list