Re: XML_Parser::setInput()
| From: | Martin Jansen | Date: | Tue, 13 Apr 2004 12:13:02 +0000 |
| Subject: | Re: XML_Parser::setInput() | ||
| References: | 1 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-1113@lists.php.net to get a copy of this message | ||
On Tue Apr 13, 2004 at 10:5240AM +0200, Stephan Schmidt wrote:
> The current CVS version has been changed and setInput() now also accepts
> files. To determine whether the parameter that has been parsed should be
> treated as file or string the following code is used:
>
> // see if it's an absolute URL (has a scheme at the beginning)
> elseif (eregi('^[a-z]+://', substr($fp, 0, 10))) {
> return $this->setInputFile($fp);
> }
> // see if it's a local file
> elseif (file_exists($fp)) {
> return $this->setInputFile($fp);
> }
> // it must be a string
> else {
> $this->fp = $fp;
> return true;
> }
>
> To me, that's PHP guessing what I want to do. And all it does, is
> slowing down the process...
Personally I like it that way, because it's just handy. Concerning
performance I do not think this is an issue here, since nobody who is
keen on performance parses XML on the fly.
In the end it probably all boils down to personal taste.
--
- Martin Martin Jansen
http://martinjansen.com/