 +     * @see     xp://xml.parser.XMLParser
 +     */
 +    public function onCData($parser, $cdata) {
-+      $this->stack[0]->addChild(new Text($cdata));
++
++      // Ignore tokens consisting entirely of whitespace
++      if (strlen($cdata) !== strspn($cdata, " \r\n\t")) {
++        $this->stack[0]->addChild(new Text($cdata));
++      }
 +    }
 +
 +    /**

       $this->assertEquals('Content', $tree->root->getContent());
       $this->assertEquals('false', $tree->root->getAttribute('empty'));
     }
Index: ports/classes/net/xp_framework/unittest/xml/DocumentTest.class.php
===================================================================
--- ports/classes/net/xp_framework/unittest/xml/DocumentTest.class.php	(revision 14454)

+     * @return  xml.Tree
+     * @throws  xml.XMLFormatException in case the data could not be parsed
+     */
+    public function parse($data, $source= NULL) {
+      with ($tree= $this->class->newInstance()); {
+        $this->callback= $this;
+        $this->stack= array(0 => NULL);
+        parent::parse($data, $source);
+        $tree->root= $this->stack[0];
+        $tree->setEncoding($this->encoding);
+        return $tree;
+      }
+    }
+
+    /**
