View Single Post
  #5 (permalink)  
Old 08-12-04
apathy- apathy- is offline
Registered User
 
Join Date: Dec 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
apathy- is an unknown quantity at this point
http://www.hansanderson.com/php/xml
a free php class to parse xml into arrays

PHP Code:
include 'xmlize.inc';
//grab xml file into a string and parse it with the array
$file file('xml_file.xml');
$xml_in_array_format xmlize(implode(''$file));
//traverse it's nasty naming format and grab the item you want into a readable variable
$something $xml_in_array_format['something'][0]['#'];
//do some random sql query with our spanky new xml data in a variable
$result mysql_query("INSERT INTO table(field) VALUES '{$something}'"); 
the naming format it uses to fit everything into an array is a bit grim, but our friend here is print_r():
PHP Code:
echo '<pre>'print_r($xml_array), '</pre>'
i just made up the code abovce, but it should all check out ok in use.

good luck
Reply With Quote