note 64420 added to ref.xml
| From: | james at clickmedia dot com | Date: | Fri, 14 Apr 2006 02:12:02 +0000 |
| Subject: | note 64420 added to ref.xml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-108024@lists.php.net to get a copy of this message | ||
Felix's fix for Raphael's code works almost perfectly for me. I'm storing HTML
within my XML so any HTML special characters are encoded as HTML entities. The dataHandler()
function trims the spaces around HTML entities, which causes problems with inline HTML like span or
anchor tags. When I need to print out my inline HTML again, all the text is bunched together with
no spaces.
To fix this problem, I just updated Felix's fixed dataHandler function. This shouldn't
cause any problems since spaces are pretty harmless in HTML.
<?php
function dataHandler($parser, $data) {
//Trims everything except for spaces
if($data = trim($data, "\\t\\n\\r\\0\\x0B")) {
$index = count($this->data) - 1;
if(isset($this->data[$index]['content'])) {
$this->data[$index]['content'] .= $data;
}
else $this->data[$index]['content'] = $data;
}
}
?>
----
Server IP: 66.163.161.117
Probable Submitter: 4.19.90.130
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/ref.xml.php
Edit -- http://master.php.net/note/edit/64420
Del: integrated -- http://master.php.net/note/delete/64420/integrated
Del: useless -- http://master.php.net/note/delete/64420/useless
Del: bad code -- http://master.php.net/note/delete/64420/bad+code
Del: spam -- http://master.php.net/note/delete/64420/spam
Del: non-english -- http://master.php.net/note/delete/64420/non-english
Del: in docs -- http://master.php.net/note/delete/64420/in+docs
Del: other reasons-- http://master.php.net/note/delete/64420
Reject -- http://master.php.net/note/reject/64420
Search -- http://master.php.net/manage/user-notes.php