0

I am using DOMDocument for xml file validation. It takes more than 30 minutes in validating a 67MB xml file. Is there any other way to improve this checking time?

2
  • Out of curiosity, what sort of XML file are you reading that's 67MB? I'm surprised PHP isn't running out of memory with a file that large. Commented Aug 9, 2010 at 21:19
  • XML file contains our own internal data :) and PHP is not running out of memory. We have given plenty of memory to PHP and there is no such memory limit error. Commented Aug 9, 2010 at 22:14

2 Answers 2

1

Have you tried XMLReader? I recall this one as being pretty decent, though I don't think I tested it on anything as large as 67 MB.

Sign up to request clarification or add additional context in comments.

1 Comment

I tried but its not working. All its saying valid atleast DOMDocument detects errors. $xml = new XMLReader(); $xml->open("../output.xml"); if($xml->setSchema('../schema.xsd')) { if($xml->isValid()) { echo 'Valid'; } else { echo 'Not valid'; } } else { echo 'Failed to load xml schema'; }
0
try {
    libxml_use_internal_errors(true);
    $oXml = new SimpleXMLElement($sXml, LIBXML_DTDVALID);
} catch (Exception $e) {
    $aErrors = libxml_get_errors();
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.