I need to read an XML file on a low memory system (don't have access to increase it). I've tried:
$xmlString = file_get_contents($file);
$doc= new DOMDocument();
$doc->loadXML($xmlString);
and
$doc= new DOMDocument();
$doc->load($file);
Both give me memory errors.
Was wondering if there is a way to read the XML sequentially node by node, so only 1 node is in memory at any given time. I don't care how long this takes as it's a nightly batch process.
The structure of the XML is very simple:
<InventoryItem>
<SKU>125244</SKU>
<Quantity>137196</Quantity>
<Status>Active</Status>
</InventoryItem>
repeated may times.
Maybe treating it as text?
Much thanks