Re: How can I load this XML file into an array? (and. . . how do I reference the values?)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/26/07, John A DAVIS <John.A.Davis@xxxxxxxxxxx> wrote:
>
>
> I've found simple examples on the web that work a simple XML file (song,
> title, etc) but I need one that will parse an XML file into elements of an
> array. And then, I need to reference these elements to validate against a
> database. The data has to do with drinking water lab samples:

use simplexml (php.net/simplexml)

you may need to do string replacement though, replacing "EN:" with
"EN_" or something; having ":" has proven to be complex for me in the
past.

$xml = file_get_contents('file.xml');
$xml = str_replace('EN:', 'EN_', $xml);
$sxml = simplexml_load_string($xml);
var_dump($sxml);

that should be enough to get you started... enjoy!

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux