cvs: php4 /pear/Experimental/XML Xml2obj.php

From: Date: Thu, 05 Jul 2001 00:12:11 +0000
Subject: cvs: php4 /pear/Experimental/XML Xml2obj.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-205@lists.php.net to get a copy of this message
cox Wed Jul 4 20:12:11 2001 EDT Modified files: /php4/pear/Experimental/XML Xml2obj.php Log: only store the char data inside tags Index: php4/pear/Experimental/XML/Xml2obj.php diff -u php4/pear/Experimental/XML/Xml2obj.php:1.3 php4/pear/Experimental/XML/Xml2obj.php:1.4 --- php4/pear/Experimental/XML/Xml2obj.php:1.3 Tue May 8 13:16:55 2001 +++ php4/pear/Experimental/XML/Xml2obj.php Wed Jul 4 20:12:10 2001 @@ -46,12 +46,13 @@ * @todo - Ability to parse file descriptors and strings, besides files * - Ability to seek for a value of a child node attribute (wish) * -* @version 0.1 +* @version 0.1.1 * @author Tomas V.V.Cox <cox@idecnet.com> */ class Xml2obj extends XML_Parser { + var $store_cdata = false; /* * Constructor * @param $file string The xml file to parse @@ -90,6 +91,7 @@ $new->atts = $attribs; } $new->name = $elem; + $this->store_cdata = true; // root element if (!isset($this->i)) { $this->obj1 = $new; @@ -115,6 +117,7 @@ $parent->children[] = $new; } $this->cdata = ''; + $this->store_cdata = false; return NULL; } @@ -123,7 +126,10 @@ */ function cdataHandler($xp, $data) { - $this->cdata .= $data; + // only store data inside tags + if ($this->store_cdata) { + $this->cdata .= $data; + } } }

« previous php.pear.cvs (#205) next »