Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pulldom.SAX2DOM Doesn't support processing instructions before the root element #53698

Open
marksmith mannequin opened this issue Aug 2, 2010 · 4 comments
Open

pulldom.SAX2DOM Doesn't support processing instructions before the root element #53698

marksmith mannequin opened this issue Aug 2, 2010 · 4 comments
Labels
3.13 new features, bugs and security fixes topic-XML type-feature A feature request or enhancement

Comments

@marksmith
Copy link
Mannequin

marksmith mannequin commented Aug 2, 2010

BPO 9453
Nosy @taleinat, @jfgossage, @ZackerySpytz
PRs
  • bpo-9453: fix SAX2DOM handling of processing instruction before first XML element #9914
  • gh-53698: Fix SAX2DOM handling of PIs before the first XML element #23012
  • Files
  • issue9453.py: Test case that demonstrates reported bug
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2010-08-02.10:49:16.664>
    labels = ['expert-XML', 'type-bug', '3.10']
    title = "pulldom.SAX2DOM Doesn't support processing instructions before the root element"
    updated_at = <Date 2020-10-28.02:27:18.793>
    user = 'https://bugs.python.org/marksmith'

    bugs.python.org fields:

    activity = <Date 2020-10-28.02:27:18.793>
    actor = 'ZackerySpytz'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['XML']
    creation = <Date 2010-08-02.10:49:16.664>
    creator = 'mark.smith'
    dependencies = []
    files = ['47867']
    hgrepos = []
    issue_num = 9453
    keywords = ['patch']
    message_count = 4.0
    messages = ['112442', '112443', '327717', '327720']
    nosy_count = 4.0
    nosy_names = ['taleinat', 'mark.smith', 'Jonathan.Gossage', 'ZackerySpytz']
    pr_nums = ['9914', '23012']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue9453'
    versions = ['Python 3.10']

    @marksmith
    Copy link
    Mannequin Author

    marksmith mannequin commented Aug 2, 2010

    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 (bpo-9373), so I've added this as an @expectedFailure, to be submitted as a patch for that ticket.

    @marksmith marksmith mannequin added topic-XML type-bug An unexpected behavior, bug, or error labels Aug 2, 2010
    @marksmith
    Copy link
    Mannequin Author

    marksmith mannequin commented Aug 2, 2010

    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.

    @jfgossage
    Copy link
    Mannequin

    jfgossage mannequin commented Oct 14, 2018

    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.

    @taleinat
    Copy link
    Contributor

    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.

    @ZackerySpytz ZackerySpytz mannequin added the 3.10 only security fixes label Oct 28, 2020
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @erlend-aasland erlend-aasland added type-feature A feature request or enhancement 3.13 new features, bugs and security fixes and removed type-bug An unexpected behavior, bug, or error 3.10 only security fixes labels Jan 5, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.13 new features, bugs and security fixes topic-XML type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants