note 39172 added to function.xml-parse

From: Date: Mon, 19 Jan 2004 18:28:24 +0000
Subject: note 39172 added to function.xml-parse
Groups: php.notes 
Request: Send a blank email to php-notes+get-63840@lists.php.net to get a copy of this message
The XmlC class doesn't parse xml with multiline-data properly. I suppose the php xml parser runs through the xml line by line and evaluates the tags and data. After each evaluation xml_set_character_data_handler() is called with the data parsed from the elements in the current line. So the script overwrites the data of the same element from previous lines in this line: $this->pointer[$this->index] = trim($data) ; If there is already set some data for the current element, $data has to be appended. I have replaced the function _cData() : function _cData( $parser, $data ) { if( trim( $data ) ) { if (empty($this->pointer[$this->index])) $this->pointer[$this->index] = trim($data) ; else $this->pointer[$this->index] .= $data."\n" ; } } Now xml with multiline-data works fine. ---- Manual Page -- http://www.php.net/manual/en/function.xml-parse.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39172 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39172&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39172&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#63840) next »