Skip to content

Instantly share code, notes, and snippets.

@BMorearty
Created January 29, 2012 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BMorearty/1700990 to your computer and use it in GitHub Desktop.
Save BMorearty/1700990 to your computer and use it in GitHub Desktop.
Tries to parse XML file and print node names. Fails if it has null bytes.
from xml.dom.pulldom import START_ELEMENT, END_ELEMENT, parse
from xml.sax import SAXParseException
doc = parse("mal.xml")
for event, node in doc:
if event == START_ELEMENT:
print node.nodeName
@BMorearty
Copy link
Author

Use this sample data file to reproduce the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment