[issue8277] ElementTree won't parse comments
Patrick W.
report at bugs.python.org
Thu Apr 1 03:37:47 CEST 2010
New submission from Patrick W. <poke at BornToLaugh.de>:
When using xml.etree.ElementTree to parse external XML files, all XML comments within that file are being stripped out. I guess that happens because there is no comment handler in the expat parser.
Example:
test.xml
--------
<example>
<nodeA />
<!-- some comment -->
<nodeB />
</example>
test.py
-------
from xml.etree import ElementTree
with open( 'test.xml', 'r' ) as f:
xml = ElementTree.parse( f )
ElementTree.dump( xml )
Result
------
<example>
<nodeA />
<nodeB />
</example>
----------
components: XML
messages: 102051
nosy: poke
severity: normal
status: open
title: ElementTree won't parse comments
type: behavior
versions: Python 3.1
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8277>
_______________________________________
More information about the Python-bugs-list
mailing list