 Added: svn:keywords
    + Id
 
+Index: ports/classes/net/xp_framework/unittest/xml/NodeTest.class.php
+===================================================================
+--- ports/classes/net/xp_framework/unittest/xml/NodeTest.class.php	(revision 14454)
++++ ports/classes/net/xp_framework/unittest/xml/NodeTest.class.php	(working copy)
+@@ -203,7 +203,7 @@
+     public function sourceOfNodeWithContent() {
+       $this->assertEquals(
+         '<expr>eval(\'1 &lt;&gt; 2 &amp;&amp; \') == &quot;Parse Error&quot;</expr>', 
+-        $this->sourceOf(new Node('expr', 'eval(\'1 <> 2 && \') == "Parse Error"'))
++        $this->sourceOf(new Node('expr', 'eval(\'1 <> 2 && \') == "Parse Error"'), INDENT_NONE)
+       );
+     }
+ 
+@@ -215,7 +215,7 @@
+     public function sourceOfNodeWithCData() {
+       $this->assertEquals(
+         '<text><![CDATA[Special characters: <>"\'&]]></text>', 
+-        $this->sourceOf(new Node('text', new CData('Special characters: <>"\'&')))
++        $this->sourceOf(new Node('text', new CData('Special characters: <>"\'&')), INDENT_NONE)
+       );
+     }
+ 
+@@ -227,7 +227,7 @@
+     public function sourceOfNodeWithPCData() {
+       $this->assertEquals(
+         '<text>A <a href="http://xp-framework.net/">link</a> to click on</text>', 
+-        $this->sourceOf(new Node('text', new PCData('A <a href="http://xp-framework.net/">link</a> to click on')))
++        $this->sourceOf(new Node('text', new PCData('A <a href="http://xp-framework.net/">link</a> to click on')), INDENT_NONE)
+       );
+     }
+     
+@@ -239,7 +239,7 @@
+     public function sourceOfNodeWithStringContent() {
+       $this->assertEquals(
+         '<node>XP &amp; APC</node>',
+-        $this->sourceOf(new Node('node', new String('XP & APC'))) 
++        $this->sourceOf(new Node('node', new String('XP & APC')), INDENT_NONE) 
+       );
+     }
+ 
+@@ -250,12 +250,7 @@
+     #[@test]
+     public function fromObject() { 
+       $this->assertEquals(
+-        "<node>\n".
+-        "  <id>1549</id>\n".
+-        "  <color>green</color>\n".
+-        "  <name>Name goes here</name>\n".
+-        "  <__id/>\n".
+-        "</node>",
++        '<node><id>1549</id><color>green</color><name>Name goes here</name><__id/></node>',
+         $this->sourceOf(Node::fromObject(newinstance('lang.Object', array(), '{
+           public $id= 1549;
+           public $color= "green";
+@@ -264,7 +259,7 @@
+           public function __construct() {
+             $this->name= new String("Name goes here");
+           } 
+-        }'), 'node'))
++        }'), 'node'), INDENT_NONE)
+       );
+     }
+   }
+Index: ports/classes/net/xp_framework/unittest/xml/XslCallbackTest.class.php
+===================================================================
+--- ports/classes/net/xp_framework/unittest/xml/XslCallbackTest.class.php	(revision 14454)
++++ ports/classes/net/xp_framework/unittest/xml/XslCallbackTest.class.php	(working copy)
+@@ -209,7 +209,7 @@
+     public function dateFormatCallback() {
+       $date= new Date('2009-09-20 21:33:00');
+       $this->assertEquals($date->toString('Y-m-d H:i:s T'), $this->runTransformation(
+-        Node::fromObject($date, 'date')->getSource(),
++        Node::fromObject($date, 'date')->getSource(INDENT_NONE),
+         'xp.date::format',
+         array('string(/date/value)', "'Y-m-d H:i:s T'")
+       ));
+@@ -225,7 +225,7 @@
+       $date= new Date('2009-09-20 21:33:00');
+       $tz= new TimeZone('Australia/Sydney');
+       $this->assertEquals($date->toString('Y-m-d H:i:s T', $tz), $this->runTransformation(
+-        Node::fromObject($date, 'date')->getSource(),
++        Node::fromObject($date, 'date')->getSource(INDENT_NONE),
+         'xp.date::format',
+         array('string(/date/value)', "'Y-m-d H:i:s T'", "'".$tz->getName()."'")
+       ));
+@@ -240,7 +240,7 @@
+     public function dateFormatCallbackWithEmptyTZ() {
+       $date= new Date('2009-09-20 21:33:00');
+       $this->assertEquals($date->toString('Y-m-d H:i:s T'), $this->runTransformation(
+-        Node::fromObject($date, 'date')->getSource(),
++        Node::fromObject($date, 'date')->getSource(INDENT_NONE),
+         'xp.date::format',
+         array('string(/date/value)', "'Y-m-d H:i:s T'", "''")
+       ));
+@@ -255,7 +255,7 @@
+     public function dateFormatCallbackWithoutTZ() {
+       $date= new Date('2009-09-20 21:33:00');
+       $this->assertEquals($date->toString('Y-m-d H:i:s T'), $this->runTransformation(
+-        Node::fromObject($date, 'date')->getSource(),
++        Node::fromObject($date, 'date')->getSource(INDENT_NONE),
+         'xp.date::format',
+         array('string(/date/value)', "'Y-m-d H:i:s T'")
+       ));

===================================================================
--- skeleton/xml/Node.class.php	(revision 14454)
+++ skeleton/xml/Node.class.php	(working copy)
@@ -6,6 +6,7 @@
  */
 
   uses(
+    'xml.Element',
     'xml.PCData',
     'xml.CData',
     'xml.XMLFormatException'
@@ -23,7 +24,7 @@
    * @see   xp://xml.Tree#addChild
    * @test  xp://net.xp_framework.unittest.xml.NodeTest
    */

Added: svn:keywords
   + Id

Index: skeleton/xml/CData.class.php
===================================================================
--- skeleton/xml/CData.class.php	(revision 14454)
+++ skeleton/xml/CData.class.php	(working copy)
@@ -4,6 +4,8 @@
  * $Id$
  */
 
+  uses('xml.Element');
+
   /**
    * CData allows to insert a CDATA section:
    *
@@ -22,9 +24,8 @@
    *
    * @purpose  Wrapper
    */
-  class CData extends Object {
-    public
-      $cdata= '';
+  class CData extends Object implements Element {
+    public $cdata= '';
       
     /**
      * Constructor
@@ -34,5 +35,21 @@
     public function __construct($cdata) {
       $this->cdata= $cdata;
     }
+
+    /**
+     * Retrieve XML representation
+     *
+     * @param   int indent default INDENT_WRAPPED
+     * @param   string encoding default 'iso-8859-1'
+     * @param   string inset default ''
+     * @return  string XML
+     */
+    public function getSource($indent= INDENT_WRAPPED, $encoding= 'iso-8859-1', $inset= '') {
+      $conv= 'iso-8859-1' != $encoding;
+      return '<![CDATA['.str_replace(']]>', ']]]]><![CDATA[>', $conv
+        ? iconv('iso-8859-1', $encoding, $this->cdata)
+        : $this->cdata
+      ).']]>';
+    }
   }
 ?>
Index: skeleton/xml/ProcessingInstruction.class.php
===================================================================
--- skeleton/xml/ProcessingInstruction.class.php	(revision 0)
