note 64420 deleted from ref.xml by bjori
| From: | bjori@php.net | Date: | Mon, 09 Oct 2006 11:07:03 +0000 |
| Subject: | note 64420 deleted from ref.xml by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-118268@lists.php.net to get a copy of this message | ||
Note Submitter: james at clickmedia dot com
----
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;
}
}
?>