CVS: Products/ParsedXML - ExtraDOM.py:1.10

Martijn Faassen <[email protected]> Sun, 19 May 2002 13:07:35 -0400
Newsgroups gmane.comp.web.zope.parsed-xml
Message-ID <[email protected]>
Update of /cvs-repository/Products/ParsedXML
In directory cvs.zope.org:/tmp/cvs-serv922

Modified Files:
	ExtraDOM.py 
Log Message:
Fix a bug; insertBefore didn't return document fragment nodes while
the DOM spec says it should.


=== Products/ParsedXML/ExtraDOM.py 1.9 => 1.10 ===
         fragment = DOM.ExpatBuilder.parseFragment(
             file, node.parentNode, namespaces)
-        if fragment.childNodes.length != 1:
-            # we could do this, actually, if we wanted
-            raise Exception, "replacing a Node with less or more " + \
-                  "than one tree of Nodes is not implemented"
+        #if fragment.childNodes.length != 1:
+        #    # we could do this, actually, if we wanted
+        #    raise Exception, "replacing a Node with less or more " + \
+        #          "than one tree of Nodes is not implemented"
         sib = node.nextSibling
         parent = node.parentNode
         parent.removeChild(node)
-        return parent.insertBefore(fragment.firstChild, sib)
-        
+        #print fragment.childNodes.length
+        #for child in fragment.childNodes:
+        #    print child.nodeType, node.nodeName
+        #    if child.nodeType == Node.TEXT_NODE:
+        #        print repr(child.data) 
+        return parent.insertBefore(fragment.firstChild, sib) # frag.firstChild
+         
 
 def writeStream(node, stream = None, encoding = None, html = 0,
                 contentType = None, prettyPrint = 0):