Hi guys,
How can i format my results when parsing xml to PHP?
At the moment the value for $data is not formated.
I was wanting to put line breaks after each <slide>.
Here is the xml file:
PHP Code:
<presentations id="root">
   <
presentation>
     <
slide>
       <
name>Picture 1</name>
       <
jpegurl>images/pic_1.swf</jpegurl>
     </
slide>
     <
slide>
       <
name>Picture 2</name>
       <
jpegurl>images/pic_2.swf</jpegurl>
     </
slide>
     <
slide
       <
name>Picture 3</name
       <
jpegurl>images/pic_3.swf</jpegurl>
     </
slide>
     <
slide
       <
name>Picture 4</name
       <
jpegurl>images/pic_4.swf</jpegurl>
     </
slide>
     <
slide
       <
name>Picture 5</name
       <
jpegurl>images/pic_5.swf</jpegurl>
     </
slide>
     <
slide
       <
name>Picture 6</name
       <
jpegurl>images/pic_6.swf</jpegurl>
     </
slide>
     <
slide
       <
name>Picture 7</name
       <
jpegurl>images/pic_7.swf</jpegurl>
     </
slide>
     <
slide
       <
name>Picture 8</name
       <
jpegurl>images/pic_8.swf</jpegurl>
     </
slide>
     <
slide
       <
name>Picture 9</name
       <
jpegurl>images/pic_9.swf</jpegurl>
     </
slide>
   </
presentation>
</
presentations
and here is the php parser code:
PHP Code:
<?
$xml_file 
"xml/images.xml";
?>
<title>Ford - Image Viewer</title>
   
<p><b>Welcome to FORD Image Viewer - Administration</b><br>
------------------------------------------------------</p><br>

<table width="750" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="150" bgcolor="#CCCCCC"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>&nbsp;&nbsp;SLIDE 
      NAME</strong></font></td>
    <td width="300" bgcolor="#CCCCCC"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>&nbsp;&nbsp;IMAGE 
      FILE NAME</strong></font></td>
    <td width="300">&nbsp;&nbsp;<img src="add_button.jpg" width="60" height="20" align="middle"></td>
  </tr>
</table>
 
<?

function characterData($parser_instance$xml_data) {    
echo 
"$xml_data"
}
 
$parser xml_parser_create();
 
xml_set_character_data_handler($parser"characterData");
if (!(
$filehandler fopen($xml_file"r"))) {    
die(
"could not open XML input"); 
}
while (
$data fread($filehandler4096)) {    
if (!
xml_parse($parser$datafeof($filehandler))) {        
die(
sprintf("XML error: %s at line %d",                    
xml_error_string(xml_get_error_code($parser)),                    
xml_get_current_line_number($parser)));    

}
fclose($filehandler); 
xml_parser_free($parser);
echo 
"</table>";
?>
Any comments greatly appreciated.

Cheers,
Suzy