       * @param   resource parser
       * @param   string data
       * @see     xp://xml.parser.XMLParser
+      */
+     public function onDefault($parser, $data) {
+     }
++
++    /**
++     * Creates a string representation of this object
++     *
++     * @return  string
++     */
++    public function toString() {
++      return sprintf(
++        "%s(version= %s encoding=%s) {\n  %s\n}",
++        $this->getClassName(),
++        $this->version,
++        $this->encoding,
++        str_replace("\n", "\n  ", xp::stringOf($this->root))
++      );
++    }
+   } 
+ ?>
 Index: skeleton/xml/parser/TreeParser.class.php
 ===================================================================
 --- skeleton/xml/parser/TreeParser.class.php	(revision 0)

      * @param   io.File file
      * @param   string c default __CLASS__ class name
      * @return  xml.Tree
@@ -165,65 +165,49 @@
     /**
      * Callback function for XMLParser
      *

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