Help Needed

[FONT=Arial][SIZE=3][COLOR=#003366]I have just used the news editor from:[/COLOR][/SIZE][/FONT]
[SIZE=3][COLOR=#003366][/COLOR][/SIZE]
[SIZE=3][COLOR=#003366]Introduction[/COLOR][/SIZE][SIZE=3][FONT=Verdana][COLOR=#003366] to XML in Flash
[/COLOR][/FONT][FONT=Verdana][COLOR=#666666] by senocular[/COLOR][/FONT][/SIZE][FONT=Verdana][COLOR=#003366]

[/COLOR][/FONT][SIZE=3]Example: News Editor[/SIZE]
[SIZE=3][/SIZE]
[SIZE=3]I am having problems parsing the xml in php, I am ripping my hair out, can anyone help? Nothing shows![/SIZE]
[SIZE=3][/SIZE]
[SIZE=3]Parser code (this is a generic one I use for all my feed, I just tweak it)[/SIZE]

<?php
function xml2array($data) {
$p = xml_parser_create();
xml_parser_set_option($p, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($p, $data, $vals, $index);
xml_parser_free($p);
$tree = array();
$i = 0;
//array_push($tree, array(‘tag’ => $vals[$i][‘tag’], ‘attributes’=> $vals[$i][‘attributes’], ‘children’ => ));
$tree = GetChildren($vals, $i);
return $tree;
}
function GetChildren($vals, &$i) {
$children = array();
$j = 0;
if (isset($vals[$i][‘value’])) array_push($children, $vals[$i][‘value’]);

$prevtag = “”;
while (++$i < count($vals)) // so pra nao botar while true :wink:
{
switch ($vals[$i][‘type’])
{
case ‘cdata’:
array_push($children, $vals[$i][‘value’]);
break;
case ‘complete’:
$children[ strtolower($vals[$i][‘tag’]) ] = ( (isset($vals[$i][‘value’])) ? $vals[$i][‘value’] : “”);
break;
case ‘open’:

       //restartindex on unique tag-name
       $j++;
       if ($prevtag &lt;&gt; $vals[$i]['tag']) {
               $j = 0;   
               $prevtag = $vals[$i]['tag'];
       }                             
       $children[strtolower($vals[$i]['tag']) ][$j] = GetChildren($vals,$i);
       break;
     case 'close':         
       return $children;
 }

}
}
function read_page($url) {
$content = “”;
$dataFile = fopen( $url , “r” ) ;
//html convertor
$source = array("\222","\226", “\223”, “\224”);
$target = array("’","-",""", “”");
if ( $dataFile ) {
while (!feof($dataFile)) {
$buffer = fread($dataFile, 4096);
$content .= str_replace($source, $target, $buffer);
//$content .= addcslashes($buffer, “\177…\377”);
}
fclose($dataFile);
} else {
die( “fopen failed for $url” ) ;
}
return $content;
}

$feeduri = “admin/readwrite/news.xml”;
$xml = read_page($feeduri);
$data = xml2array($xml);

//print_r($data);
$media = $data[‘news’][0];
?>
<?php
$showlim = ((isset($_GET[‘limit’])) ? $_GET[‘limit’] : 10);
for($i = 0; $i < $showlim; $i++) {
$entry = $media[‘entry’][$i]; // as $entry) {
?>
<div id=“title”>
<? echo $entry[‘title’]; ?> </div>
<div id=“desc”>
<? echo $entry[‘body’]; ?></div>
<hr />
<?
}
?>

[SIZE=3]This is the xml from the browser:[/SIZE]
[SIZE=3][/SIZE]
<news>
<entry>
<title>No 2</title>
<body>this is number 2</body>
</entry>
<entry>
<title>This is 1</title>
<body>some text for 1</body>
</entry>
</news>

much appreciated if someone can

many thanks
Brian