>>>>> "Lee" == Lee Doolan <[EMAIL PROTECTED]> writes:
>>>>> "Michael" == Michael Smith <[EMAIL PROTECTED]> writes:
    Michael> Hey, I'm looking for a function to take an XML file and
    Michael> turn it into a PHP array with the same structure.

    Lee> here's something that I found on the internet a few months
    Lee> back.

here I am following up my own post yet again.. I forgot to include an example of
use.  here's a little snippet that uses xmlize():


    ##  probably actually should use join here.  I guess I was too concerned
    ##  about the whitespace  
    $xData="";
    while (list($k, $v)= each($xml)) {
        $xData .= trim($v);
    }

    ##  turn the XML into an array
    $ary= xmlize($xData);

    ##  split into several different arrays depending on donation amount
    $hofTable= $ary['patronHofTable']['#']['tableData']['0']['#']['hofTableEntry'];
    $platinumAry= $goldAry= $silverAry= $insiderAry= array();

    if (!isset($hofTable['0']['#']['text'])) {
        foreach($hofTable as $hofkey => $hofVal) {
            $entry= $hofVal['#']['Data']['0']['#'];
            if ($entry > 999) {
                $platinumAry[]= $hofVal;

            } else if ($entry > 499) {
                $goldAry[]= $hofVal;

            } else if ($entry > 99) {
                $silverAry[]= $hofVal;

            } else {
                $insiderAry[]= $hofVal;
            }
        }
    }

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to