[Python-checkins] CVS: python/dist/src/Lib/xml/dom minidom.py,1.16,1.17

Martin v. Löwis python-dev@python.org
Thu, 28 Dec 2000 10:40:58 -0800


Update of /cvsroot/python/python/dist/src/Lib/xml/dom
In directory usw-pr-cvs1:/tmp/cvs-serv16398

Modified Files:
	minidom.py 
Log Message:
Merge changes up to 1.10 from PyXML:
- implement hasAttribute and hasAttributeNS (1.7)
- Node.replaceChild():  Update the sibling nodes to point to newChild.  Set
  the .nextSibling attribute on oldChild instead of adding a .newChild 
  attribute (1.9).


Index: minidom.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/minidom.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** minidom.py	2000/12/20 14:47:24	1.16
--- minidom.py	2000/12/28 18:40:56	1.17
***************
*** 146,151 ****
          newChild.nextSibling = oldChild.nextSibling
          newChild.previousSibling = oldChild.previousSibling
!         oldChild.newChild = None
          oldChild.previousSibling = None
          return oldChild
  
--- 146,155 ----
          newChild.nextSibling = oldChild.nextSibling
          newChild.previousSibling = oldChild.previousSibling
!         oldChild.nextSibling = None
          oldChild.previousSibling = None
+         if newChild.previousSibling:
+             newChild.previousSibling.nextSibling = newChild
+         if newChild.nextSibling:
+             newChild.nextSibling.previousSibling = newChild
          return oldChild
  
***************
*** 464,467 ****
--- 468,477 ----
          del self._attrsNS[(node.namespaceURI, node.localName)]
  
+     def hasAttribute(self, name):
+         return self._attrs.has_key(name)
+                      
+     def hasAttributeNS(self, namespaceURI, localName):
+         return self._attrsNS.has_key((namespaceURI, localName))    
+         
      def getElementsByTagName(self, name):
          return _getElementsByTagNameHelper(self, name, [])