views:

64

answers:

1

Let's say I want to be able to validate that a 50GB+ XML file conforms to a given XSD. I could use

DOMDocument::load & DOMDocument::schemaValidate

but that will take all of time on loading and will generally exhaust all available memory for me. Is there any way to feed an XSD to a SAX or any other type of stream processor and have it verify that all is well?

+1  A: 

You may use XMLReader:

$reader = new XMLReader();
$reader->open('xmlfile.xml');
$reader->setSchema('schemafile.xsd');
while($reader->read());
$reader->close();
Heri