i have a problem with this script, problem being i assume it the hyphen in the node names it throwing the xmlreader out i have to use xml reader instead of simplexml as the file is 1gb and our server is only 1gb, anyway this is the xml:
<dataroot>
<Hotel_All_Active_x0020_08-29-12>
...................
</Hotel_All_Active_x0020_08-29-12>
<Hotel_All_Active_x0020_08-29-12>
...................
</Hotel_All_Active_x0020_08-29-12>
</dataroot>
then this is the script im trying to parse with if i run the script i get one result back, i know i could perform a transformation on the xml but as we may have to go through the process every other week i want to keep it as simple and direct as possible, i know in simple xml you can just encase in curly brackets and wondered if there is the same problem.
hears the code thats meant to cycle through all the Hotel_All_Active_x0020_08-29-12:
$reader = new XMLReader();
$reader->open("Hotel_All.xml");
$dom = new DomDocument();
while ($reader->read() && $reader->name !== 'Hotel_All_Active_x0020_08-29-12');
while ($reader->name === 'Hotel_All_Active_x0020_08-29-12')
{
$node = new SimpleXMLElement($reader->readOuterXml());
$nodename = $node->name;
$reader->next('Hotel_All_Active_x0020_08-29-12');
}
but it never moves on to the next element, is there an easy way to deal with the illegal characters in xmlreader or is the only option to use xsl to change the names?
this is not the complete script but i know up until $reader->next(); everything is fine