Re: libxml returns codes and xmlreader

From: Date: Fri, 19 Aug 2011 12:02:21 +0000
Subject: Re: libxml returns codes and xmlreader
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-54722@lists.php.net to get a copy of this message
On 8/19/11 7:04 AM, Nicolai Scheer wrote:
Hi!
On Fri, Aug 19, 2011 at 12:27, Nicolai Scheer
<scope@planetavent.de>
wrote:
I've noticed, that some of the libxml return codes
get
"simplified" when used in xmlreader which can
be quite
problematic.
Use
libxml_get_errors() So you're suggesting to call another function rather than returning something that is already there? I see how libxml_get_errors() can be used to work around this, but to my mind, this function should not be called unless I know that in fact there are errors. Nevertheless, is there a "real" reason why this is not implemented? Anyone else feeling uncomfortable with "calling additional functions to check for error conditions"? Greetings, Nico
It is modeled after the .NET XMLReader interface with simple boolean return values. You can file a feature request to enable exceptions to be thrown from the reader on invalid XML. i.e. argument to constructor whether or not to throw exceptions (default false). Right now regardless of returning false or an int value, you would have to check something to determine if it were an error or no data (either a function as it is right now or for a specific return value), so it's always an extra step. Rob

« previous php.internals (#54722) next »