Created
September 24, 2011 19:33
-
-
Save netdesign/1239747 to your computer and use it in GitHub Desktop.
working XML parser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import lxml.etree as tr | |
| context = tr.iterparse('content.rdf.u8', events=('end',), tag='{http://dmoz.org/rdf/}ExternalPage') | |
| for event, elem in context: | |
| print('%s\n' % elem.text.encode('utf-8')) | |
| elem.clear() | |
| while elem.getprevious() is not None: | |
| del elem.getparent()[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment