[phpXML] RE: [phpXML] Re: Entities
Brought to you by:
bs_php,
nigelswinson
From: <die...@ga...> - 2001-10-08 17:43:23
|
part of the problem is that the entities array is in the wrong order (as of the last version i downloaded). here are the entity de/encoding functions i am currently using. i also have added a class level boolean called 'encode', which i use to toggle whether i want phpxml to auto-encode or not. function encode_entities($text) { if($this->encode){ return htmlspecialchars($text); } return $text; } function decode_entities($text){ if($this->encode){ return strtr($text,array_flip($this->entities)); } return $text; } > -----Original Message----- > From: lu...@sa... [mailto:lu...@sa...] > Sent: Tuesday, July 24, 2001 12:24 AM > To: us...@li... > Subject: [phpXML] Re: Entities > > > Liz, > > I just tried, this doesn't work for me. I get good results only if this > array is empty... > > Luc > > At 06:24 24/07/01 +0000, you wrote: > > >Thankz Luc, > > > >I checked the lines that you pointed me to and I thought I'd let you know > >what I discovered: > > > >When reading though the file I thought !!! "wait a sec! HTML4.0 doesn't > >specify an entity encoding for the apostrophe." > > > >I did some research. And sure enough, it is not an HTML entity. > The simple ' > >character is good enough. Also, the " for " is not truly needed in > >HTML. > > > >By the way, in my file the semi-colon was missing in the ' entity > >conversion array. > > > >The browser still couldn't handle the ' with the ; inserted, so I > >adjusted the xml.php file to the ISO Latin set since I am not > sure if this > >conversion will be needed in another script that I write. > > > >122 /** > >123 * var $entities = array ( "&" => "&", "<" => "<", ">" => > >">", > >124 * "'" => "&apos", '"' => """ ); > >125 */ > >126 var $entities = array ( "&" => "&", "<" => "<", ">" => > >">", > >128 "'" => "'", '"' => """ ); > > > >Now the CDATA Sections seems to render fine in IE5+. :-) > > > >I wonder why the ISO Latin codes were not used in xmlphp. > Especially since > >ISO 8859/1 is the 8-bit single-byte coded graphic character set. > > > >Thankz again :-) > > > >Liz Bostetter > > > > > >-----Original Message----- > >From: lu...@sa... [mailto:lu...@sa...] > >Sent: Tuesday, July 24, 2001 12:12 AM > >To: us...@li... > >Subject: [phpXML] Re: phpxml Version 1.N.4 > > > > > >Liz, > > > >I use phpxml for the same reason. > > > >In order to have a correct output I had to empty the array entities (near > >line 123 > >var $entities = array ( ); > > > >Luc > > > >At 03:09 24/07/01 +0000, you wrote: > > >HI > > > > > >I am using xmlphp on a site that retreives an XML file from > another server. > > >The XML file contains > > >CDATA Sections. > > >When I try to display the contents of the XML file in a table > in HTML to a > > >browser all the apostrophe characters within the CDATA Section > are being > > >rendered as &apos as in (Picket's) (Picket&aposs). (I haven't > checked to > >see > > >if other General Entity type characters do this also.) > > >The results page's source code shows (Picket&aposs)..... missing > >semi-colon? > > > > > >In the original XML file, the character is typed as a ' and not as the > > >entity '. > > > > > >Any ideas out there of what is going on and how I could > correct the HTML > > >display? > > > > > >Thankz for any adive you can give. :-) > > > > > >Liz > > > -- > This message has been sent through the <phpXML/> user discussion > list. To unsubscribe, please visit > https://sslsites.de/mailinglisten/user/us...@li.../ > -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ |