note 85415 added to function.xml-set-character-data-handler
| From: | jhill at live dot com | Date: | Fri, 29 Aug 2008 02:11:20 +0000 |
| Subject: | note 85415 added to function.xml-set-character-data-handler | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-143964@lists.php.net to get a copy of this message | ||
To detect that concatenation of data is taking place, you can keep track of whether the last
function call was to the data processing function.
e.g. using $this->inside_data variable below:
xml_set_element_handler($this->parser, "start_tag", "end_tag");
xml_set_character_data_handler($this->parser, "contents");
protected function contents($parser, $data)
{
switch ($this->current_tag) {
case "name":
if ($this->inside_data)
$this->name .= $data; // need to concatenate data
else
$this->name = $data;
break;
...
}
$this->inside_data = true;
}
protected function start_tag($parser, $name)
{
$this->current_tag = $name;
$this->inside_data = false;
}
protected function end_tag() {
$this->current_tag = '';
$this->inside_data = false;
}
----
Server IP: 64.71.164.2
Probable Submitter: 67.169.182.160
----
Manual Page -- http://www.php.net/manual/en/function.xml-set-character-data-handler.php
Edit -- https://master.php.net/note/edit/85415
Del: integrated -- https://master.php.net/note/delete/85415/integrated
Del: useless -- https://master.php.net/note/delete/85415/useless
Del: bad code -- https://master.php.net/note/delete/85415/bad+code
Del: spam -- https://master.php.net/note/delete/85415/spam
Del: non-english -- https://master.php.net/note/delete/85415/non-english
Del: in docs -- https://master.php.net/note/delete/85415/in+docs
Del: other reasons-- https://master.php.net/note/delete/85415
Reject -- https://master.php.net/note/reject/85415
Search -- https://master.php.net/manage/user-notes.php