[Python-bugs-list] [ python-Feature Requests-715263 ] Access to DOM
Element attributes using __getitem__
SourceForge.net
noreply at sourceforge.net
Tue Sep 9 21:54:02 EDT 2003
Feature Requests item #715263, was opened at 2003-04-04 07:26
Message generated for change (Comment added) made by fdrake
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=715263&group_id=5470
Category: XML
Group: None
>Status: Closed
>Resolution: Rejected
Priority: 5
Submitted By: chris burdess (bluezoo)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: Access to DOM Element attributes using __getitem__
Initial Comment:
Element objects in XML DOM implementations in Python
should provide access to their attributes in a standard
Python way, using __getitem__. Thus, the following code
to print the version of an XMI document should work:
import xml.dom.minidom
print
xml.dom.minidom.parse(filename).documentElement['xmi.version']
----------------------------------------------------------------------
>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2003-09-09 23:53
Message:
Logged In: YES
user_id=3066
It's not clear that this is reasonable.
DOM Level 2 elements may provide access to attributes using
either name (qualified name if namespaces are in play), or
(uri, localname) pairs. What constitutes the "right thing"
isn't clear, but implementing a __getitem__() that takes
either a name or a pair seems too magical.
The DOM API is already huge; extending it, even when the
"right thing" is clear, is pretty risky, and introduces true
difficulty and compatibility issues for implementors.
For these reasons, I'm rejecting this request. To appeal,
this matter should be taken up on the XML-SIG mailing list;
I'll make sure minidom conforms to decisions of group. I
can't speak for the other implementors.
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger)
Date: 2003-05-12 13:52
Message:
Logged In: YES
user_id=80475
At first blush, this seems reasonble. Fred, what do you
think?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=715263&group_id=5470
More information about the Python-bugs-list
mailing list