Validating a large XML file ~400MB in PHP
I have a large XML file (around 400MB) that I need to ensure is well-formed before I start processing it. First thing I tried was something similar to below, which is great as I can find out if XML is not well formed and which parts of XML are 'bad' $doc = simplexml_load_string($xmlstr); if (!$doc) { $errors = libxml_get_errors(); foreach ($errors as $error) { echo display_xml_error($error); } libxml_clear_errors(); } Also tried... $doc->load( $tempFileName, LIBXML_DTDLOAD|LIBXML_DTDVALID ) I tested this with a file of about 60MB, but anything a lot larger (~400MB) causes something which is