PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » XML » XML_RSS » Bug #5662

allow XML_RSS to handle strings as input

Details

Request #5662allow XML_RSS to handle strings as input
Submitted2005-10-11 21:43 UTC
Fromjam at zoidtechnologies dot com
Assignedclay
StatusClosed
PackageXML_RSS
PHP VersionIrrelevant
OSLinux (FC4)
Roadmaps(Not assigned)

Comments

[2005-10-11 21:43 UTC] jam at zoidtechnologies dot com

Description:
------------
I have several rss feeds in a database table and instead of putting the data in a file as I've done previously I'd like to have XML_RSS parse the string from the database. Per a suggestion on #pear ([aJ]), I added a 2nd optional argument that flags the $handle as a string instead of a filename.

Test script:
---------------
--- RSS.php-original 2005-10-11 16:54:44.000000000 -0400
+++ RSS.php 2005-10-11 17:33:36.000000000 -0400
@@ -124,11 +124,14 @@
* @access public
* @param mixed File pointer or name of the RDF file.
+ * @param mixed set to '1' if $handle is a string (i.e. from database table)
* @return void
*/
- function XML_RSS($handle = '')
+ function XML_RSS($handle = '', $dataType = null)
{
$this->XML_Parser();

- if (@is_resource($handle)) {
+ if ($dataType == 1) {
+ $this->setInputString($handle);
+ } elseif (@is_resource($handle)) {
$this->setInput($handle);
} elseif ($handle != '') {

[2006-09-14 07:24 UTC] clay at php dot net

Thank you for your bug report. This issue has been fixed
in the latest released version of the package, which you can download at
http://pear.php.net/get/XML_RSS

This was fixed in XML_RSS release 0.9.9, which added a dependency on XML_Parser 1.1.0 or greater. XML_Parser 1.1.0 added support for XML data passed in as a string.