$xml_string= ben a h2o k ; //load the xml string using simplexml function$xml = simplexml_load_string($xml_string); //loop through the each node of moleculeforeach ($xml->molecule as $record){ //attribute are accessted by echo $record['name'], ' '; //node are accessted by -> operator echo $record->symbol, ' '; echo $record->code, '
';}
复制代码
php, xml