Re: xml error handling for 5.1

From: Date: Fri, 04 Feb 2005 17:26:24 +0000
Subject: Re: xml error handling for 5.1
References: 1 2 3 4 5  Groups: php.xml.dev 
Request: Send a blank email to php-xml-dev+get-539@lists.php.net to get a copy of this message
On 4.2.2005 18:01 Uhr, Rob Richards wrote:
Christian Stocker wrote:
I did some first, very basic tests. Looks promising. But 2 questions: - Can I only get the last error? Shouldn't I be able to get more? Usually libxml2 throws more than one error during parsing (if there's an error) and it would be nice, if I could get all of them. But looking quickly at your code and the one from libxml2, you're using the global error functions of libxml2, which only stores the really last one. Too bad, if libxml2 would use a stack-thingie for that as well, it would have been easy.
Right now you can only get the last error. I wanted to start simple it could at least get it into the 5.1 release and make sure this is the way the new error stuff should go.
Fair enough. But then we should at least make sure, that the API stays the same for future releases. while ($error = libxml_get_last_error()) { /* do your stuff here */ libxml_clear_last_error(); } should (in the future, when we have the stack), loop through all errors, but for now only shows the last one (which is fine). libxml_clear_errors() would clear the whole stack. Therefore, the only thing, we would have to do right now, is to add the libxml_clear_last_error() function, which for now is an "alias" to libxml_clear_errors(). Just my 2 cents ;)
Updated patch. You can now do: $old_state = libxml_use_interal_errors(false); and well as $current_state = libxml_use_interal_errors();
great. many thanks chregu
Rob
-- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | chregu@bitflux.ch | gnupg-keyid 0x5CE1DECB

« previous php.xml.dev (#539) next »