There does seem to be a glitch here. When I add the lines
NodeList nl1=nl.item(0).getChildNodes();
for(int i=0;i<nl1.getLength();++i)
System.out.println(nl1.item(i).getNodeName()+" = "
+nl1.item(i).getNodeValue());
to your extension, it's printing out the "A" node. When I modify the first
line to
NodeList nl1=nl.item(0).getFirstChild.getChildNodes();
it's printing out the #text node which is "B"'s child. Not right.
I suspect the bug is in getChildNodes(), which is relatively new code. You
might want to try getFirstChild()/getNextSibling() as an alternative --
usually more efficient anyway -- and see if that works better for you.
Suppose I should log this into Bugzilla as well...