This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vapier
Recipients vapier
Date 2020-11-13.06:22:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1605248574.32.0.904298964211.issue42341@roundup.psfhosted.org>
In-reply-to
Content
$ python3
Python 3.8.5 (default, Aug  2 2020, 15:09:07) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from xml.dom import minidom

# Lets parse a simple XML file with comment & text nodes in the top level.
>>> dom = minidom.parseString('<?xml version="1.0" encoding="UTF-8"?>\n<!--foo-->\n<!--bar-->\n<main>\n<!--foo-->\n<!--bar-->\n</main>\n')

# Where did those newlines get to outside of <main> ?
>>> dom.toxml()
'<?xml version="1.0" ?><!--foo--><!--bar--><main>\n<!--foo-->\n<!--bar-->\n</main>'

# No Text nodes in the root list :(.
>>> dom.childNodes
[<DOM Comment node "'foo'">, <DOM Comment node "'bar'">, <DOM Element: main at 0x7f6f5394c040>]

# But they all exist fine under <main>.
>>> dom.childNodes[2].childNodes
[<DOM Text node "'\n'">, <DOM Comment node "'foo'">, <DOM Text node "'\n'">, <DOM Comment node "'bar'">, <DOM Text node "'\n'">]
History
Date User Action Args
2020-11-13 06:22:54vapiersetrecipients: + vapier
2020-11-13 06:22:54vapiersetmessageid: <1605248574.32.0.904298964211.issue42341@roundup.psfhosted.org>
2020-11-13 06:22:54vapierlinkissue42341 messages
2020-11-13 06:22:54vapiercreate