Re: Entity handling in PHP-XPath
Brought to you by:
bs_php,
nigelswinson
From: Nigel S. <nig...@us...> - 2002-04-18 21:47:40
|
Line 2400 of Php.XPath for me reads: // Check whether the function handling function is available. if (!method_exists(&$this, $method)) { // Display an error message. $this->_displayError("While parsing an XPath expression, ". "the function \"$function\" could not be handled, because this ". "version does not support this function.", __LINE__, __FILE__); } if ($bDebugThisFunction) echo "Calling function $method($absoluteXPath, $arguments)\n"; As obviously I'm using the development version. Which one are you using?? I think your fix is probably right. Put it this way, if it didn't do what you wanted it to do beforehand, and it does now, then it's probably right :o) CData has always been a bit of a mess with Php.XPath. I -think- it's handled better in the development version soon to be released as V3. But I think there's still a little more work to do. After performance, it is probably next on the hit list.... Nigel =========================== For the most recent version of Php.XPath, and an archive of this list visit: http://www.sourceforge.net/projects/phpxpath ----- Original Message ----- From: "Nigel Armstrong" <Nig...@te...> To: <nig...@us...> Sent: Thursday, April 18, 2002 5:33 PM Subject: Entity handling in PHP-XPath > Hi, > > I have a query about the code around line 2400 of XPath.class.php: > > // Replace entities. > if (!$this->inCData) > $text = strtr($text, $this->entities); > > This code does not do what the comment suggests. Instead it encodes > 'special' characters in the text as entites. Any entities in the text > get 'doubly coded' - eg. " becomes &quot; > > I think the code should be:- > > // Replace entities. > if (!$this->inCData) > $text = strtr($text, array_flip($this->entities)); > > That's what I have in my local copy at the moment. What do you think? > > |