Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

To read XML files use:

$XMLFile = new XMLReader();

if($XMLFile->open('file.xml') === TRUE){                            

    while($XMLFile->read()) {

        //Do something

    }

    $XMLFile->close();

}

If I will find in xml file sample string:

!+_)(*&^%$#@!~}|"?,../;'\[]=-

Critical error is displayed and the parsing is terminated:

Warning: XMLReader::read() [xmlreader.read]: file.xml:16: parser error : xmlParseEntityRef: no name in test.php on line 841
Warning: XMLReader::read() [xmlreader.read]: An Error Occured while reading in test.php on line 841

In this case, I would like to handle the error and delete the xml file. Someone may know how to fix this error?

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.