There are generally two ways to handle XML: "LibXML," which uses an industry-standard binary library to turn the XML into an in-memory data structure, and "Twig," which walks through the data invoking subroutines along the way (but without reading it all into memory). Both solutions are known to work correctly with any XML data. If you're processing a terabyte XML file with gigabytes of memory – which sometimes happens – use Twig. It can do it.