Bug report
Bug description:
"""test.xml
<?xml version="1.0" encoding="UTF-8"?>
<root>
<foo>not_comment</foo>
<bar><!--comment_1-->
<bar/>
</bar>
<baz> <!--comment_2-->
<baz/>
</baz>
</root>"""
import xml.dom.minidom
tree = xml.dom.minidom.parse('test.xml')
root = tree.documentElement
for child_node in root.childNodes:
if child_node.localName is not None:
print(f"{child_node.localName}: '{child_node.firstChild.nodeValue}'")
# foo: 'not_comment'
# bar: 'comment_1'
# baz: ' '
CPython versions tested on:
3.14
Operating systems tested on:
Windows