So lost, xml, php, arrays help pls!

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I am totally lost.

I have an xml script example as follows:

<?xml version="1.0" encoding="utf8" ?>

I have this printing to an array with the following php code:

class RSSParser {

  var $struct = array();  // holds final structure
  var $curptr;  // current branch on $struct
  var $parents = array();  // parent branches of current branch

  function RSSParser($url) {
   $this->curptr =& $this->struct;  // set ref to base
   $xmlparser = xml_parser_create();
   xml_set_object($xmlparser, $this);
   xml_set_element_handler($xmlparser, 'tag_open', 'tag_close');
   xml_set_character_data_handler($xmlparser, 'cdata');
   $fp = fopen($url, 'r');

   while ($data = fread($fp, 4096))
     xml_parse($xmlparser, $data, feof($fp))
     || die(sprintf("XML error: %s at line %d",


  function tag_open($parser, $tag, $attr) {
   $i = count($this->curptr['children']);
   $j = count($this->parents);
  $this->curptr['children'][$i]=array();  // add new child element
  $this->parents[$j] =& $this->curptr;  // store current position as
   $this->curptr =& $this->curptr['children'][$i];  // submerge to
newly created child element
   $this->curptr['name'] = $tag;
   if (count($attr)>0) $this->curptr['attr'] = $attr;

  function tag_close($parser, $tag) {
   $i = count($this->parents);
   if ($i>0) $this->curptr =& $this->parents[$i-1];  // return to
parent element
   unset($this->parents[$i-1]);  // clear from list of parents

  function cdata($parser, $data) {
   $data = trim($data);
   if (!empty($data)) {
     $this->curptr['value'] .= $data;


$myparser = new RSSParser('CreditCardBank.xml');

echo "<pre>";
$results = ($myparser->struct);


I get the following array:

[1] => Array
                                    [name] => STARTER
                                    [children] => Array
                                            [0] => Array
                                                    [name] => NAME
                                                    [value] => Silver




I need to be able to take the above array results and use them to
populate a menu, yet at the same time create ANOTHER array that
cleanses the :  [value] => Silver Person&  to remove the capitol
letters, spaces and charachters other than hyphens, letters and
numbers. I need the new array to show something like Silver Person& ==>

Is this EVEN possible??

Site Timeline