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.
Created on 2019年11月08日 08:10 by celinecyc, last changed 2022年04月11日 14:59 by admin. This issue is now closed.
| Messages (2) | |||
|---|---|---|---|
| msg356229 - (view) | Author: celinecyc (celinecyc) | Date: 2019年11月08日 08:10 | |
issue8277 It couldn't work for those comments before the root element. It will raise an error that "xml.etree.ElementTree.ParseError: multiple elements on top level". Example: test.xml -------- <?xml version="1.0" encoding="utf-8"?> <!-- comments here doesn't work --> <root node> <nodeA /> <!-- comments here is ok --> <nodeB /> </root node> test.py ------- from xml.etree import ElementTree class MyTreeBuilder(ElementTree.TreeBuilder): def comment(self, data): self.start(ElementTree.Comment, {}) self.data(data) self.end(ElementTree.Comment) with open('c:/temp/t.xml', 'r') as f: xml = ElementTree.parse( f, parser=ElementTree.XMLParser(target=MyTreeBuilder())) ElementTree.dump(xml) |
|||
| msg356698 - (view) | Author: Stefan Behnel (scoder) * (Python committer) | Date: 2019年11月15日 17:41 | |
Duplicate of issue 9521 (and issue 24287). |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:59:23 | admin | set | github: 82923 |
| 2019年11月15日 17:41:44 | scoder | set | status: open -> closed superseder: xml.etree.ElementTree skips processing instructions when parsing messages: + msg356698 resolution: duplicate stage: resolved |
| 2019年11月08日 08:10:53 | celinecyc | create | |