[XML-SIG] [ pyxml-Bugs-609826 ] nextNode() refuses to step down 2 levels
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 16 Sep 2002 01:49:01 -0700
Bugs item #609826, was opened at 2002-09-16 01:49
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=106473&aid=609826&group_id=6473
Category: SAX
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: nextNode() refuses to step down 2 levels
Initial Comment:
This is a truly bizzare bug. I have a simple program
which walks the tree, thus:
#!/usr/bin/python2.2
import xml.dom
from xml.dom.ext.reader import Sax2
inxml = open("in.xml")
inDoc = inReader.fromStream(inxml)
inWalker = inDoc.createTreeWalker(inDoc,
NodeFilter.SHOW_ELEMENT, None, 0)
while 1:
print "quux - '%s' '%s"" %
(inWalker.currentNode.namespaceURI,
inWalker.currentNode.localName)
next = inWalker.nextNode()
if next == None:
break
This is in.xml mark 1:
?xml version="1.0" encoding="utf-8" ?>
<D:propertyupdate xmlns:D="DAV:">
<D:remove>
<intact>
<removeme/>
</intact>
</D:remove>
<D:set>
<mjuuk0wz foo="bar"/>
<mook0wz foo="bar" bar="baz"/>
<nest1>
<nest2 nest="2">
<nest3 nest="3"/>
</nest2>
</nest1>
</D:set>
</D:propertyupdate>
Running this file through the walker produces the
following debug:
quux - 'None' 'None'
quux - 'DAV:' 'propertyupdate'
quux - 'DAV:' 'remove'
quux - 'None' 'intact'
quux - 'None' 'removeme'
Bizzare! It stops at removeme, and doesn't traverse the
<D:set> tree. However, if you nuke removeme, leaving
"<intact/>", you get:
quux - 'None' 'None'
quux - 'DAV:' 'propertyupdate'
quux - 'DAV:' 'remove'
quux - 'None' 'intact'
quux - 'DAV:' 'set'
quux - 'None' 'mjuuk0wz'
quux - 'None' 'mook0wz'
quux - 'None' 'nest1'
quux - 'None' 'nest2'
quux - 'None' 'nest3'
Odd ... NOW it traverses the whole tree. I cannot for
the life of me figure out what this is - an issue with
dropping down more than x levels? FWIW, it also happens
when you reverse "set" and "remove". This occurs with
both 0.11.x, and 0.12.x (Python 2.1 and 2.2). Is there
a better way to walk the tree?
Thanks in advance!
:) d
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=106473&aid=609826&group_id=6473