note 109814 modified in function.xml-error-string by danbrown
| From: | danbrown@php.net | Date: | Fri, 31 Aug 2012 15:44:40 +0000 |
| Subject: | note 109814 modified in function.xml-error-string by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-190325@lists.php.net to get a copy of this message | ||
Two notes in one. Here is the combination of xml_get_error_code()
and xml_error_string() to get the error printout as an echo
response Also, I tested before and after xml_parser_free() -- as
expected, the error is indeed cleared with the free() so check your error before calling
xml_parser_free() Pushing a deadline or I would add in sample
faulted xml for full p.o.c. somebody else want to step up for
that?? G <?php $p
= xml_parser_create(); xml_parse_into_struct($p, $data, $vals,
$index); //This call prints error echo 'ERROR if any
'.xml_error_string(xml_get_error_code($p)); xml_parser_free($p); echo
"Index array\\n"; print_r($index); echo
"\\nVals array\\n"; print_r($vals); //No Error
left here to be printed echo 'ERROR if any
'.xml_error_string(xml_get_error_code($p)); exit; ?>
--was--
Two notes in one.
Here is the combination of xml_get_error_code() and xml_error_string() to get the error printout as
an echo response
Also, I tested before and after xml_parser_free() -- as expected, the error is indeed cleared with
the free() so check your error before calling xml_parser_free()
Pushing a deadline or I would add in sample faulted xml for full p.o.c.
somebody else want to step up for that??
G
$p = xml_parser_create();
xml_parse_into_struct($p, $data, $vals, $index);
//This call prints error
echo 'ERROR if any '.xml_error_string(xml_get_error_code($p));
xml_parser_free($p);
echo "Index array\n";
print_r($index);
echo "\nVals array\n";
print_r($vals);
//No Error left here to be printed
echo 'ERROR if any '.xml_error_string(xml_get_error_code($p));
exit;
http://php.net/manual/en/function.xml-error-string.php