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

xml.dom.minidom does not support default namespaces #57311

Closed
crass mannequin opened this issue Oct 4, 2011 · 3 comments
Closed

xml.dom.minidom does not support default namespaces #57311

crass mannequin opened this issue Oct 4, 2011 · 3 comments
Labels
topic-XML type-bug An unexpected behavior, bug, or error

Comments

@crass
Copy link
Mannequin

crass mannequin commented Oct 4, 2011

BPO 13102
Nosy @jkloth, @ezio-melotti
Files
  • test.py: Illustrative test case
  • 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 = <Date 2014-06-20.02:35:52.127>
    created_at = <Date 2011-10-04.20:11:53.454>
    labels = ['expert-XML', 'type-bug', 'invalid']
    title = 'xml.dom.minidom does not support default namespaces'
    updated_at = <Date 2014-06-20.02:35:52.127>
    user = 'https://bugs.python.org/crass'

    bugs.python.org fields:

    activity = <Date 2014-06-20.02:35:52.127>
    actor = 'ezio.melotti'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-06-20.02:35:52.127>
    closer = 'ezio.melotti'
    components = ['XML']
    creation = <Date 2011-10-04.20:11:53.454>
    creator = 'crass'
    dependencies = []
    files = ['23313']
    hgrepos = []
    issue_num = 13102
    keywords = []
    message_count = 3.0
    messages = ['144924', '144927', '221026']
    nosy_count = 4.0
    nosy_names = ['jkloth', 'ezio.melotti', 'BreamoreBoy', 'crass']
    pr_nums = []
    priority = 'normal'
    resolution = 'not a bug'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue13102'
    versions = ['Python 2.6', 'Python 2.7']

    @crass
    Copy link
    Mannequin Author

    crass mannequin commented Oct 4, 2011

    When using getAttributeNS, attributes with no namespace should be considered as having the default namespace for that scope. See examples in http://www.w3.org/TR/REC-xml-names/#defaulting. Python's xml.dom.minidom will always set the namespace to None for attributes that have no namespace prefix.

    I've attached a test program to illustrate this issue in action. The output I get is:
    [((None, u'attr'), u'value1')]
    [(('http://www.w3.org/2000/xmlns/', 'xmlns'), u'http://path/to/ns2#'), ((None, u'attr'), u'value2')]
    [((u'http://path/to/ns2#', u'attr'), u'value3')]
    Successfully got child3 attr value

    In the first two cases the namespaceURI is None, but it should be set to the default namespace specified in the root element. I believe this problem occurs with all *NS functions. Not tested in 3.x.

    @crass crass mannequin added topic-XML type-bug An unexpected behavior, bug, or error labels Oct 4, 2011
    @jkloth
    Copy link
    Contributor

    jkloth commented Oct 4, 2011

    Please read the link which you posted. Quoting the second paragraph, second sentence:

    "Default namespace declarations do not apply directly to attribute names;"

    and from the third paragraph, third sentence:

    "The namespace name for an unprefixed attribute name always has no value."

    Therefore minidom *is* conformant by having None as the namespace-uri for unprefixed attribute names.

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jun 19, 2014

    From the statement in msg144927 this can be closed as "not a bug".

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    topic-XML type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants