[Python-checkins] CVS: python/dist/src/Lib/xml/dom minidom.py,1.7,1.8 pulldom.py,1.7,1.8

Martin v. Löwis python-dev@python.org
Fri, 6 Oct 2000 15:36:08 -0700


Update of /cvsroot/python/python/dist/src/Lib/xml/dom
In directory slayer.i.sourceforge.net:/tmp/cvs-serv2065

Modified Files:
	minidom.py pulldom.py 
Log Message:
minidom: access attribute value before printing it
         correct order of constructor args in createAttributeNS
pulldom: use symbolic names for uri and localnames
         correct usage of createAttribute and setAttributeNode signatures.


Index: minidom.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/minidom.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** minidom.py	2000/09/24 05:21:58	1.7
--- minidom.py	2000/10/06 22:36:02	1.8
***************
*** 332,336 ****
          for a_name in a_names:
              writer.write(" %s=\"" % a_name)
!             _write_data(writer, self._get_attributes()[a_name])
              writer.write("\"")
          if self.childNodes:
--- 332,336 ----
          for a_name in a_names:
              writer.write(" %s=\"" % a_name)
!             _write_data(writer, self._get_attributes()[a_name].value)
              writer.write("\"")
          if self.childNodes:
***************
*** 430,434 ****
      def createAttributeNS(self, namespaceURI, qualifiedName):
          prefix,localName = _nssplit(qualifiedName)
!         return Attr(namespaceURI, qualifiedName, localName, prefix)
  
      def getElementsByTagNameNS(self, namespaceURI, localName):
--- 430,434 ----
      def createAttributeNS(self, namespaceURI, qualifiedName):
          prefix,localName = _nssplit(qualifiedName)
!         return Attr(qualifiedName, namespaceURI, localName, prefix)
  
      def getElementsByTagNameNS(self, namespaceURI, localName):

Index: pulldom.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/pulldom.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** pulldom.py	2000/09/24 21:54:14	1.7
--- pulldom.py	2000/10/06 22:36:03	1.8
***************
*** 28,51 ****
  
      def startElementNS(self, name, tagName , attrs):
!         if name[0]:
              # When using namespaces, the reader may or may not
              # provide us with the original name. If not, create
              # *a* valid tagName from the current context.
              if tagName is None:
!                 tagName = self._current_context[name[0]] + ":" + name[1]
!             node = self.document.createElementNS(name[0], tagName)
          else:
              # When the tagname is not prefixed, it just appears as
!             # name[1]
!             node = self.document.createElement(name[1])
  
          for aname,value in attrs.items():
!             if aname[0]:
!                 qname = self._current_context[name[0]] + ":" + aname[1]
!                 attr = self.document.createAttributeNS(name[0], qname)
              else:
!                 attr = self.document.createAttribute(name[0], name[1])
              attr.value = value
!             node.setAttributeNode(qname, attr)
          
          parent = self.curNode
--- 28,53 ----
  
      def startElementNS(self, name, tagName , attrs):
!         uri,localname = name
!         if uri:
              # When using namespaces, the reader may or may not
              # provide us with the original name. If not, create
              # *a* valid tagName from the current context.
              if tagName is None:
!                 tagName = self._current_context[uri] + ":" + localname
!             node = self.document.createElementNS(uri, tagName)
          else:
              # When the tagname is not prefixed, it just appears as
!             # localname
!             node = self.document.createElement(localname)
  
          for aname,value in attrs.items():
!             a_uri, a_localname = aname
!             if a_uri:
!                 qname = self._current_context[a_uri] + ":" + a_localname
!                 attr = self.document.createAttributeNS(a_uri, qname)
              else:
!                 attr = self.document.createAttribute(a_localname)
              attr.value = value
!             node.setAttributeNode(attr)
          
          parent = self.curNode