Created
February 25, 2016 09:24
-
-
Save sotoz/78a6c62880212c4e9bd9 to your computer and use it in GitHub Desktop.
Show broken xml errors with php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
libxml_use_internal_errors(true); | |
$sxe = simplexml_load_string("<?xml version='1.0'><broken><xml></broken>"); | |
if ($sxe === false) { | |
echo "Failed loading XML\n"; | |
foreach(libxml_get_errors() as $error) { | |
echo "\t", $error->message; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment