AW: AW: AW: [PEAR-DEV] PACKAGE PROPOSAL: XML_XMLPull

From: Date: Mon, 15 Sep 2003 13:26:11 +0000
Subject: AW: AW: AW: [PEAR-DEV] PACKAGE PROPOSAL: XML_XMLPull
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-21506@lists.php.net to get a copy of this message
Hi, > As Stephan points out above, with large files you get a huge > array, because > XML_Parser reads to the end of the file. I'd forgotten the reason why I > used the PEAR::XML_SaxFilters IO iterators but this reminds me - > they make > sure that the array is only built up to the current end of the parsed > buffer so no problem with large documents. I think there will be no problem when parsing a string directly, as you do not do this with a large aount of data. I can only see a problem, when you are reading a file that is some MB in size... Regarding your other problems: 1. I sent a patch to Tomas which resolves the problem of having different methods to parse a file or string. 2. If you do not manage to create a working version of XML_Pull based on XML_Parser, I could offer my help on this. The easiest way will be overloading the parse method: function parse() { if (!is_resource($this->fp)) { return $this->raiseError("no input"); } if (!empty($this->stack)) { return array_shift($this->stack); } if ($data = fread($this->fp, 2048)) { $err = $this->parseString($data, feof($this->fp)); if (PEAR::isError($err)) { fclose($this->fp); return $err; } } else { fclose($this->fp); return false; } if (!empty($this->stack)) { return array_shift($this->stack); } return false; } This is just to point you in the right direction, I should it be working, but I haven't tested it. Stephan

« previous php.pear.dev (#21506) next »