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

From: Date: Fri, 26 Oct 2007 21:58:52 +0000
Subject: Re: How can I load this XML file into an array? (and. . . how do I reference the values?)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-263738@lists.php.net to get a copy of this message
On 10/26/07, John A DAVIS <John.A.Davis@state.or.us> 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!

« previous php.general (#263738) next »