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.

classification
Title: DeprecationWarning when parse ElementTree with a doctype in 2.7
Type: behavior Stage: resolved
Components: XML Versions: Python 2.7
process
Status: closed Resolution: out of date
Dependencies: 15083 Superseder: Backport warnings in ElementTree/cElementTree modules and fix bugs
View: 30365
Assigned To: serhiy.storchaka Nosy List: eli.bendersky, scoder, serhiy.storchaka
Priority: normal Keywords:

Created on 2017-03-30 15:03 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg290846 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-03-30 15:03
DeprecationWarning is emitted when parse ElementTree with a doctype in 2.7.

$ python2.7 -Wa
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml.etree.ElementTree as ET
>>> ET.XML('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>text</html>')
/usr/lib/python2.7/xml/etree/ElementTree.py:1638: DeprecationWarning: This method of XMLParser is deprecated.  Define doctype() method on the TreeBuilder target.
  DeprecationWarning,
/usr/lib/python2.7/xml/etree/ElementTree.py:1638: DeprecationWarning: This method of XMLParser is deprecated.  Define doctype() method on the TreeBuilder target.
  DeprecationWarning,
<Element 'html' at 0xb7025b4c>
msg293933 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-05-18 17:58
Fixed in issue30365.
History
Date User Action Args
2022-04-11 14:58:44adminsetgithub: 74134
2017-05-18 17:58:55serhiy.storchakasetstatus: open -> closed
superseder: Backport warnings in ElementTree/cElementTree modules and fix bugs
messages: + msg293933

resolution: out of date
stage: needs patch -> resolved
2017-03-30 15:03:26serhiy.storchakasetdependencies: + Rewrite ElementTree tests in a cleaner and safer way
2017-03-30 15:03:07serhiy.storchakacreate