Transporter_ii Posted February 17, 2007 Share Posted February 17, 2007 Ok, saying I'm not much of a programmer is an understatement, but I'm sitting here with a copy Beginning PHP 5 and MySQL 5, and a working script that I have been trying to modify unsuccessfully for a week now. To make it short, the script parses an XML file formatted like this: <CHOICES>A, B, C, D</CHOICES> And saves the values to an array like this: save value to "questions" array if this is a CHOICES tag if ($val[tag] == "CHOICES") { $questions[$questionNo]['choices'] = $val[value]; Note: later on in the script, it "explodes" the data: // split choices into "choices" array $choices = explode(", ", $questions[0]['choices']); I really want to format the XML like this: <CHOICE>A</CHOICE><CHOICE>B</CHOICE> etc. or like this: <CHOICEA>A</CHOICEA><CHOICEB>B</CHOICEB> etc. Is there a way to get data into the array the way I want to do it, but have the data in the array work like it did the way the script was originally structured. Every example I see on parsing an XML file with PHP, seems like it assumes only one set of tags in the XML structure for a certain element, but for what I'm wanting to do, this keeps making me do kludgey workarounds. Any help would be greatly appreciated. Transporter_ii Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.