Issue 28234: In xml.etree.ElementTree docs there are many absent Element class links (original) (raw)

Created on 2016-09-21 10:27 by py.user, last changed 2022-04-11 14:58 by admin.

Files
File name Uploaded Description Edit
element-link.diff py.user,2016-09-21 10:27 Add Element links review
Pull Requests
URL Status Linked Edit
PR 9766 serhiy.storchaka,2018-10-09 14:05
Messages (8)
msg277121 - (view) Author: py.user (py.user) * Date: 2016-09-21 10:27
https://docs.python.org/3/library/xml.etree.elementtree.html#reference 1. Comment 2. iselement() 3. ProcessingInstruction 4. SubElement 5. Element.find() 6. ElementTree._setroot() 7. TreeBuilder Applied a patch to the issue that adds Element class links.
msg277187 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-09-22 01:37
Mostly looks good to me. I left some comments on the code review.
msg277194 - (view) Author: py.user (py.user) * Date: 2016-09-22 06:11
> I left some comments on the code review. Left an answer on a comment. (ISTM, email notification doesn't work there, I didn't get email.)
msg277197 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-09-22 06:26
In lxml Element is a factory function, not a class.
msg277209 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-09-22 08:39
Serhiy, what’s the relevance? In the built-in Element Tree package, it is a class: <https://docs.python.org/3.5/library/xml.etree.elementtree.html#element-objects>.
msg277211 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-09-22 09:02
The built-in ElementTree package is derived from lxml.etree. I suppose that the documentation is inherited from lxml.etree. The built-in ElementTree package supports duck typing. The element object is not always an instance of the Element class. iselement() is not equal to isinstance(e, Element), it just tests the existence of the tag attribute. Many ElementTree functions have fast path for Element, but work with duck typed classes too. I believe that in particular you can mix Python and C implementations of Element and lxml.etree elements in one tree.
msg277219 - (view) Author: py.user (py.user) * Date: 2016-09-22 11:31
Serhiy Storchaka wrote: > I believe that in particular you can mix Python and > C implementations of Element and lxml.etree elements in one tree. The xml.etree.ElementTree.ElementTree() can accept lxml.etree.Element() as a node, but node in node is impossible. >>> import xml.etree.ElementTree as etree_xml >>> import lxml.etree as etree_lxml >>> >>> elem1 = etree_xml.Element('a') >>> elem2 = etree_lxml.Element('b') >>> elem1.append(elem2) Traceback (most recent call last): File "", line 1, in TypeError: must be xml.etree.ElementTree.Element, not lxml.etree._Element >>>
msg277255 - (view) Author: py.user (py.user) * Date: 2016-09-23 08:47
Added a reply to the patch about SubElement(). (Realy email notification doesn't work in review. I left a message while publication, and it didn't come.)
History
Date User Action Args
2022-04-11 14:58:37 admin set github: 72421
2018-10-09 14:05:31 serhiy.storchaka set pull_requests: + <pull%5Frequest9156>
2016-09-23 08:47:46 py.user set messages: +
2016-09-22 11:31:25 py.user set messages: +
2016-09-22 09:02:11 serhiy.storchaka set messages: +
2016-09-22 08:39:48 martin.panter set messages: +
2016-09-22 06:26:38 serhiy.storchaka set nosy: + serhiy.storchakamessages: +
2016-09-22 06:11:29 py.user set messages: +
2016-09-22 01:37:36 martin.panter set nosy: + martin.pantermessages: + versions: + Python 2.7, Python 3.5, Python 3.7
2016-09-21 16:35:13 serhiy.storchaka set nosy: + scoder, eli.benderskystage: patch review
2016-09-21 10:27:48 py.user create