Q:

alternate to simplexml_load_string() in php4

Im using this function simplexml_load_string() in my file which is doing search lucene based.
But its not working in php4.
please suggest me a function similar to this one so that i dont have to change my coding much.
this is the sample of my code :-
function handleResponse($data) 
    {
        if ($data) 
        {
            $xml = simplexml_load_string($data);
            $results = array();
            foreach ($xml->result->doc as $story) 
            {
                $xmlarray = array();
                try
                {
                    foreach ($story as $item) 
                    {
                        $name = $item->attributes()->name;
                        $value = $item;
                        $xmlarray["$name"] = "$value";
                    }
                } 
                catch (Exception $e) 
                {
                    echo 'Problem handling XML array.'; 
                }
                if ($this->debug) echo "checking if ".$xmlarray['score']." > ".$this->min_score;
                if ($xmlarray['score'] > $this->min_score) $results[] = $xmlarray;
            }
            $results['response']=$xml->result->attributes()->numFound;
        }
        else
        {
            $results=false;
        }
        return $results;
    }

here $data is having data in xml format like 
<?xml version="1.0" encoding="UTF-8"?>
<response>

<lst name="responseHeader">
 <int name="status">0</int>
 <int name="QTime">2</int>
 <lst name="params">
  <str name="explainOther"/>
  <str name="fl">*,score</str>

  <str name="indent">on</str>
  <str name="start">0</str>
  <str name="q">reliance</str>
  <str name="hl.fl"/>
  <str name="qt">dismax</str>
  <str name="wt">dismax</str>

  <str name="version">2.2</str>
  <str name="rows">10</str>
 </lst>
</lst>
<result name="response" numFound="5" start="0" maxScore="1.7840868">
 <doc>
  <float name="score">1.7840868</float>
  <str name="scheme_name">Reliance Diversified Power Sector Fund - Growth</str>

  <str name="scheme_nav">75.23</str>
 </doc>
 <doc>
  <float name="score">1.7840868</float>
  <str name="scheme_name">Reliance Diversified Power Sector Fund - Growth</str>
  <str name="scheme_nav">75.23</str>
 </doc>
</result>
</response>

please suggest some function similar to simplexml_load_string() in PHP4 so that I can be escaped from changing my coding.

A:

I have not used this class myself, but phpClasses.org is sporting a simpleXML implementation for PHP4 that looks quite ok:
http://www.phpclasses.org/browse/package/4484.html

