note 39172 deleted from function.xml-parse by didou
| From: | didou@php.net | Date: | Thu, 03 Feb 2005 19:50:25 +0000 |
| Subject: | note 39172 deleted from function.xml-parse by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-84472@lists.php.net to get a copy of this message | ||
Note Submitter: spacyspacy
----
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.