classification
Title: pulldom.SAX2DOM Doesn't support processing instructions before the root element
Type: behavior Stage: patch review
Components: XML Versions: Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Jonathan.Gossage, ZackerySpytz, mark.smith, taleinat
Priority: normal Keywords: patch

Created on 2010-08-02 10:49 by mark.smith, last changed 2020-10-28 02:27 by ZackerySpytz.

Files
File name Uploaded Description Edit
issue9453.py Jonathan.Gossage, 2018-10-14 17:04 Test case that demonstrates reported bug
Pull Requests
URL Status Linked Edit
PR 9914 closed Jonathan.Gossage, 2018-10-16 17:51
PR 23012 open ZackerySpytz, 2020-10-28 02:26
Messages (4)
msg112442 - (view) Author: Mark Smith (mark.smith) * Date: 2010-08-02 10:49
pulldom.SAX2DOM raises a TypeError if it encounters a processing instruction before the root element of an XML document.

It is valid to have a processing instruction before the root node of a document (and SAX2DOM's superclass, PullDOM supports this), so this behaviour is invalid.

I've encountered this bug while writing unit tests for pulldom (#9373), so I've added this as an @expectedFailure, to be submitted as a patch for that ticket.
msg112443 - (view) Author: Mark Smith (mark.smith) * Date: 2010-08-02 10:53
My recommendation is that SAX2DOM is deprecated and removed from the standard library rather than fixing this issue. The class is currently undocumented, has weird behaviour, and is unused within the Python standard library, so I don't expect that this will cause undue pain.
msg327717 - (view) Author: Jonathan Gossage (Jonathan.Gossage) * Date: 2018-10-14 17:04
This test case demonstrates that the issue still exists in 3.8. The fix is relatively simple but I am unsure whether it is worthwhile as the original comments on the quality and usability of SAX2DOM are spot on. My recommendation would be to mark it as pending and close it at the end of a month if no-one submits a fix.
msg327720 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2018-10-14 19:20
Proposing removal of SAX2DOM doesn't seem unreasonable to me. However, considering it hasn't been removed so far, we'll need good reason to do so since that would break backwards compatibility.

Jonathan, if the solution to this is simple, I say go for it and make a PR.
History
Date User Action Args
2020-10-28 02:27:18ZackerySpytzsetversions: + Python 3.10, - Python 3.2
2020-10-28 02:26:15ZackerySpytzsetnosy: + ZackerySpytz
pull_requests: + pull_request21929
2018-10-16 17:51:50Jonathan.Gossagesetkeywords: + patch
stage: patch review
pull_requests: + pull_request9272
2018-10-14 19:20:56taleinatsetmessages: + msg327720
2018-10-14 17:04:26Jonathan.Gossagesetfiles: + issue9453.py
nosy: + taleinat, Jonathan.Gossage
messages: + msg327717

2010-08-02 10:53:49mark.smithsetmessages: + msg112443
2010-08-02 10:49:16mark.smithcreate