note 57415 rejected from ref.xml by betz

From: Date: Mon, 03 Oct 2005 17:08:49 +0000
Subject: note 57415 rejected from ref.xml by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-96306@lists.php.net to get a copy of this message
Note Submitter: leofoggy at gmail dot com ---- I liked too the xmlparser class by monte, but trying to parse a tag with some '\n' chars cause some problems. Parsing this file: <?xml version="1.0" encoding="iso-8859-1"?> <example>line1 line2 line3</example> it returns that: Array ( [0] => Array ( [name] => EXAMPLE [content] => line3 ) ) making some debugs print I saw that the function splits "line1 line2 line3" in 3 strings, and for 3 times she will write the content in the same array cell, so at the end only "line3" will remain. I think to have solved this problem (if I can call it so) modifying this function: <?PHP function dataHandler($parser, $data){ if(!empty($data)) { $_output_idx = count($this->output) - 1; echo "datahandler: id=".$_output_idx." data: ".$data."<br><br>"; $this->output[$_output_idx]['content'] .= $data; // just changed '= $data' with '.=$data' } } ?> now the output is: Array ( [0] => Array ( [name] => EXAMPLE [content] => line1 line2 line3 ) ) maybe you can help me understanding why the function breaks the tag content in apart when finding a '\n' char. Leo Borsari USI Lugano Swiss

« previous php.notes (#96306) next »