0

Hi,

I have a PHP file that gets an XML files from a HTML form. The PHP files needs to generate a new HTML file containing a table with the the data retrived from the XML file. I was able to this this properly (using expat). However, before adding the data to the table, I would need to sort the data based on one of the XML elements in my file. This is where my problem begins. I'm trying to build an array from by XML file using the following code:

 $xmlFile = $_GET["xmlFile"];
 $p = xml_parser_create();
 xml_parse_into_struct($p, $xmlFile, $vals, $index);
 xml_parser_free($p);
 echo "First array <br>";
 print_r($vals);
 echo "<br>Second Array<br>";
 print_r($index);

However, both $vals and $index are empty! Any suggestions on what is wrong and how to fix it? I'm fairly new to PHP.

4
Contributors
3
Replies
7
Views
5 Years
Discussion Span
Last Post by veedeoo
0

We need to see your target xml file. It all depends on your xml file structure. There are several methods in parsing xml file. It all depends on the target document.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.