Estoy creando este código XML a partir de PHP. El código que me genera es este:
Código HTML:
<?xml version="1.0" encoding="iso-8859-1"?> <categoria>BlackHats <noticia> <titulo>asdsdf</titulo> <resumen>sdfsdf</resumen> <publicado>Sábado30, Diciembre de 1899 | 12:00 AM Por: sdfsdfsd</publicado> <url>noticias.php%3Faccion%3Dmostrar%26categoria%3D1%26noticia%3D2%26jcgrmsid%3D93019492e5955cba512dc8dee6354a92</url> </noticia> </categoria>
Cita:
me ayudan a resolver este error. El código lo genero de esta forma:Unable to locate a reference to a supported schema kind (DTD,DCD,W3C Schema,XML-Data,Biz Talk) within this ... // aquie se me trunca el mensaje
Código PHP:
function PHPToRSS($filename,$tituloweb){
$filename = strtolower(str_replace(' ', '', index)) . '.xml';
if (file_exists($filename)) {
@unlink($filename);
}
session_start();
$sid = "&jcgrmsid=".session_id();
$handler = fopen($filename,'w+');
$query = "SELECT *,DAYOFMONTH(fecha_publicacion) as dia, DAYOFWEEK(fecha_publicacion) as semana, MONTH(fecha_publicacion) as mes, YEAR(fecha_publicacion) as year, DATE_FORMAT(fecha_publicacion,'%h:%i %p') as hora FROM jcgrm_noticias WHERE activa<>0 GROUP BY idcat";
$result = mysql_query($query) or die(mysql_error());
$rssfile = "<?xml version="1.0\" encoding=\"iso-8859-1\"?>";
while($row = mysql_fetch_assoc($result)){
$idnoticia = $row['idnoticia'];
$titulo = $row['titulo'];
$resumen = nl2br($row['resumen']);
$fecha = UltimoMensaje($row['dia'],$row['semana'],$row['mes'],$row['year'],$row['hora'],$row['autor'],1);
// Sacamos el titulo de la categoria correspondiente
$querycat = "SELECT * FROM jcgrm_categorias_noticias WHERE idcat=".$row['idcat']."";
$resultcat = mysql_query($querycat) or die(mysql_error());
$rowcat = mysql_fetch_assoc($resultcat);
$url = urlencode("noticias.php?accion=mostrar&categoria=".$row['idcat']."¬icia=".$row['idnoticia']."".$sid."");
$rssfile.= "<categoria>".$rowcat['titulo']."";
$rssfile.= " <noticia>";
$rssfile.= " <titulo>".$titulo."</titulo>";
$rssfile.= " <resumen>".$resumen."</resumen>";
$rssfile.= " <publicado>".$fecha."</publicado>";
$rssfile.= " <url>".$url."</url>";
$rssfile.= " </noticia>";
$rssfile.= "</categoria>";
}
if(!fputs($handler, $rssfile))
{
echo "no se pudo crear el Rss";
}
fclose($handler);
}