[issue13275] Recommend xml.etree for XML processing
New submission from Alexey Shamrin <shamrin@gmail.com>: There are many libraries in Python stdlib [1] xml.dom xml.dom.minidom xml.dom.pulldom xml.sax xml.etree Tutorial mentions xml.dom and xml.sax. [2] In my experience xml.etree is the best library to quickly load some xml and mess with it. It would be nice to recommend people xml.etree in the tutorial [2] and in the beginning of section 19, "Structured Markup Processing Tools". [1] [1]: http://docs.python.org/library/markup.html [2]: http://docs.python.org/tutorial/stdlib.html#batteries-included ---------- assignee: docs@python components: Documentation messages: 146484 nosy: ash, docs@python priority: normal severity: normal status: open title: Recommend xml.etree for XML processing _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13275> _______________________________________
Changes by Florent Xicluna <florent.xicluna@gmail.com>: ---------- components: +XML type: -> behavior versions: +Python 2.7, Python 3.2, Python 3.3 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13275> _______________________________________
Changes by Florent Xicluna <florent.xicluna@gmail.com>: ---------- nosy: +flox _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13275> _______________________________________
Changes by Petri Lehtinen <petri@digip.org>: ---------- nosy: +petri.lehtinen _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13275> _______________________________________
Éric Araujo <merwok@netwok.org> added the comment: It makes sense that SAX and DOM would be mentioned in the tutorial: SAX is similar to how HTMLParser works and is used in many languages; DOM is the official W3C API and is used in many languages, despite its ugliness. ElementTree is not a very elegant API in my opinion, but the majority seems to disagree as it was included in Python 2.5, so I wouldn’t object to a one-line edition in the doc to suggest it. If you’d like to work on a doc patch, here are guidelines: http://docs.python.org/documenting http://docs.python.org/devguide ---------- nosy: +eric.araujo _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13275> _______________________________________
Changes by Ezio Melotti <ezio.melotti@gmail.com>: ---------- nosy: +ezio.melotti _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13275> _______________________________________
Terry J. Reedy <tjreedy@udel.edu> added the comment: In the tutorial, "The xml.dom and xml.sax packages" should be expanded to "The xml.dom, xml.sax, and xml.etree packages". I suspect that the current line predates the addition of .etree. We try to mostly not give opinion-based recommendations; the docs are for facts. Some people recommend using lxml instead of any of the above ;-). "The documentation for the xml.dom and xml.sax packages are the definition of the Python bindings for the DOM and SAX interfaces." could be followed by a factual sentence like "xml.etree provides an third alternative." Looking more: the intro to 19.6. xml.dom — The Document Object Model API nicely explains the difference between SAX and DOM processing as sequential versus random access. The intro to 19.13. xml.etree.ElementTree — The ElementTree XML API says nothing about how it compares to the others. Perhaps the sentence should be "xml.etree provides a tree-based interface different from xml.dom." (assuming this is a fact). Make your suggestion. ---------- nosy: +terry.reedy _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13275> _______________________________________
Changes by Tshepang Lekhonkhobe <tshepang@gmail.com>: ---------- nosy: +tshepang _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13275> _______________________________________
Tshepang Lekhonkhobe <tshepang@gmail.com> added the comment: @Araujo bit offtopic, but which XML library have you found most elegant? Is it available in the stdlib? ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13275> _______________________________________
Éric Araujo <merwok@netwok.org> added the comment: (I haven’t found an elegant XML lib, and have not yet needed to look for one as I touch very little XML.) ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13275> _______________________________________
Serhiy Storchaka added the comment: The wording in the tutorial was changed in issue23891. Now ElementTree is mentioned on first place. In the "Structured Markup Processing Tools" section ElementTree is listed before other XML processing modules. I think this issue can be closed now. ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13275> _______________________________________
Changes by Serhiy Storchaka <storchaka@gmail.com>: ---------- resolution: -> out of date stage: -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13275> _______________________________________
participants (8)
-
Alexey Shamrin
-
Ezio Melotti
-
Florent Xicluna
-
Petri Lehtinen
-
Serhiy Storchaka
-
Terry J. Reedy
-
Tshepang Lekhonkhobe
-
Éric Araujo