         {
             for (i = 0; i < n; i++)
             {
-                if (compareNodes(sl[i], tl[i]))
-                    retval = true;
+                var nk:String = sl[i].nodeKind();
+                if (nk == "text")
+                {
+                    if (sl[i].text() != tl[i].text())
+                    {
+                        trace(sn, "different number of text nodes: cur=", sl[i].text(), "xml=", tl[i].text());
+                        retval = true;
+                    }
+                }
+                else if (nk == "element")
+                {
+                    if (compareNodes(sl[i], tl[i]))
+                        retval = true;
+                }
             }
         }
         return retval;

        var retval:Boolean = false;
        var q:String;
        var i:int;
        var n:int;
        var m:int;
        var st:String;
        var tt:String;
        var sv:String;
        var tv:String;
        
        // compare tag names
        var sn:String = s.name().toString();

                else 
                {
                    sv = s['@' + st].toString();
                    tv = t['@' + tt].toString();
                    if (sv != tv)
                    {
                        if (xywidthheight[st] == 1)
