[Python-checkins] python/dist/src/Lib/xml/dom minidom.py,1.49,1.50

loewis@users.sourceforge.net loewis@users.sourceforge.net
2003年1月26日 00:59:34 -0800


Update of /cvsroot/python/python/dist/src/Lib/xml/dom
In directory sc8-pr-cvs1:/tmp/cvs-serv17592
Modified Files:
	minidom.py 
Log Message:
Merge with PyXML 1.82:
Correct various typos. Fixes #674700.
Set newly created attribute via setNamedItem.
Index: minidom.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/minidom.py,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** minidom.py	25 Jan 2003 15:28:29 -0000	1.49
--- minidom.py	26 Jan 2003 08:59:32 -0000	1.50
***************
*** 17,21 ****
 import xml.dom
 
! from xml.dom import EMPTY_NAMESPACE, EMPTY_PREFIX
 from xml.dom.minicompat import *
 from xml.dom.xmlbuilder import DOMImplementationLS, DocumentLS
--- 17,21 ----
 import xml.dom
 
! from xml.dom import EMPTY_NAMESPACE, EMPTY_PREFIX, XMLNS_NAMESPACE, domreg
 from xml.dom.minicompat import *
 from xml.dom.xmlbuilder import DOMImplementationLS, DocumentLS
***************
*** 385,392 ****
 d[name] = value
 
! def _set_prefix(self, value):
 nsuri = self.namespaceURI
! if value == "xmlns":
! if self.namespaceURI and self.namespaceURI != XMLNS_NAMESPACE:
 raise xml.dom.NamespaceErr(
 "illegal use of 'xmlns' prefix for the wrong namespace")
--- 385,392 ----
 d[name] = value
 
! def _set_prefix(self, prefix):
 nsuri = self.namespaceURI
! if prefix == "xmlns":
! if nsuri and nsuri != XMLNS_NAMESPACE:
 raise xml.dom.NamespaceErr(
 "illegal use of 'xmlns' prefix for the wrong namespace")
***************
*** 396,400 ****
 newName = self.localName
 else:
! newName = "%s:%s" % (value, self.localName)
 if self.ownerElement:
 _clear_id_cache(self.ownerElement)
--- 396,400 ----
 newName = self.localName
 else:
! newName = "%s:%s" % (prefix, self.localName)
 if self.ownerElement:
 _clear_id_cache(self.ownerElement)
***************
*** 537,540 ****
--- 537,541 ----
 node = Attr(attname)
 node.ownerDocument = self._ownerElement.ownerDocument
+ self.setNamedItem(node)
 node.value = value
 else:
***************
*** 1009,1013 ****
 # Make sure we don't add an instance __dict__ if we don't already
 # have one, at least when that's possible:
! __slots__ = ()
 
 nodeType = Node.TEXT_NODE
--- 1010,1015 ----
 # Make sure we don't add an instance __dict__ if we don't already
 # have one, at least when that's possible:
! # XXX this does not work, CharacterData is an old-style class
! # __slots__ = ()
 
 nodeType = Node.TEXT_NODE
***************
*** 1133,1137 ****
 # Make sure we don't add an instance __dict__ if we don't already
 # have one, at least when that's possible:
! __slots__ = ()
 
 nodeType = Node.CDATA_SECTION_NODE
--- 1135,1140 ----
 # Make sure we don't add an instance __dict__ if we don't already
 # have one, at least when that's possible:
! # XXX this does not work, Text is an old-style class
! # __slots__ = ()
 
 nodeType = Node.CDATA_SECTION_NODE
***************
*** 1213,1217 ****
 """Mix-in class that supports the publicId and systemId attributes."""
 
! __slots__ = 'publicId', 'systemId'
 
 def _identified_mixin_init(self, publicId, systemId):
--- 1216,1221 ----
 """Mix-in class that supports the publicId and systemId attributes."""
 
! # XXX this does not work, this is an old-style class
! # __slots__ = 'publicId', 'systemId'
 
 def _identified_mixin_init(self, publicId, systemId):

AltStyle によって変換されたページ (->オリジナル) /