Ver Mensaje Individual
  #9 (permalink)  
Antiguo 08/04/2007, 20:44
erikrocha
 
Fecha de Ingreso: marzo-2005
Mensajes: 23
Antigüedad: 19 años, 1 mes
Puntos: 0
Re: Generar XML con PHP

Ahora que veo bien, en mi server:

domxml

DOM/XML : enabled
DOM/XML : API Version 20020815
libxml Version : 20616
HTML Support : enabled
XPath Support : enabled
XPointer Support: enabled

Esta información me muestra PHPINFO, como veo al parecer DOM/XML esta habilitado y por lo tanto si esta soportado, yo estaba equivocado yo pense que PHP4 no soportaba DOM/XML sino la versíon 5.

haber entonces si me dan una mano, aquí esta mi script que génera el XML, en mi máquina (en local) funciona perfectamente, tengo instalado la versión: PHP Version 5.1.6

<?
/*Llamando a las funciones*/
include ("functions.php");

/*Iniciando las funciones*/
dbConnect();

/*Guardando variable de funciones*/
$get_num_music = getNumSongs();
$music = getSongs();

$doc = new DomDocument("1.0");
$playlist = $doc->createElement("playlist");
$playlist = $doc->appendChild($playlist);
$trackList = $doc->createElement("trackList");
$trackList = $playlist->appendChild($trackList);

//bucle para mostrar los appendChild
for($i=1;$i<=$get_num_music;$i++){

$row = mysql_fetch_assoc($music);
$track = $doc->createElement("track");
$track = $trackList->appendChild($track);
$title = $doc->createElement("title");
$title = $track->appendChild($title);
$txtTitle = $doc->createTextNode("$row[titulo]");
$txtTitle = $title->appendChild($txtTitle);
$creator = $doc->createElement("creator");
$creator = $track->appendChild($creator);
$txtCreator = $doc->createTextNode("$row[grupo]");
$txtCreator = $creator->appendChild($txtCreator);
$location = $doc->createElement("location");
$location = $track->appendChild($location);
$txtLocation = $doc->createTextNode("$row[link]");
$txtLocation = $location->appendChild($txtLocation);
$image = $doc->createElement("image");
$image = $track->appendChild($image);
$txtImage = $doc->createTextNode("$row[imagen]");
$txtImage = $image->appendChild($txtImage);
}

$doc->save("../playlist.xml");
?>

Ahora el error que me sale cuando lo ejecuto en el server (Internet) es el siguiente:

Warning: domdocument(): Start tag expected, '<' not found in /home/content/e/r/i/erikrocha/html/funciones/genPlaylist.php on line 13

Fatal error: Call to undefined function: createelement() in /home/content/e/r/i/erikrocha/html/funciones/genPlaylist.php on line 14


donde la línea 13 es:
$doc = new DomDocument("1.0");

y la 14:
$playlist = $doc->createElement("playlist");

P.D: debo decir que en mi server tienen instalado la versión: PHP Version 4.3.11

Haber algún comentario al respecto, estaré muy agradecido.

Hasta pronto.