I am trying to read a large XML file and add it to a database.
Here is a very small example of the XML:
<?xml version="1.0" encoding="UTF-8"?>
<shows>
<show id="33041">
<title>The Sound of Music</title>
<category>Musicals</category>
<price currency="GBP">
<min_price>12</min_price>
<max_price>42</max_price>
</price>
</show>
</shows>
The problem is that I do not know how to refer to the id value in <show id=“33041”>
Here is a snippet of code I am using:
$xml = new XMLReader();
$xml->open(Test.xml);
while ($xml->read()) {
switch ($xml->name) {
case "event":
$xml->read();
$conf["event"] = $xml->value;
$xml->read();
break;
}
}
I have no problem in actually INSERTing into my db but how do I get the ID bit in value in <show id=“33041”> into an array or string??
Thanks for any help.