Comunidad de diseño web y desarrollo en internet online

Generar xml actualizable

Citar            
MensajeEscrito el 06 Dic 2008 04:57 pm
hola compañeros..........saben que estaba en mi humilde morada creando un xml cuando paaffffff, no me resulto el codigo....jajajaja....con el que queria lograr el siguiente fin.
Crear un archivo.xml....y luego actualizarlo con el mismo formulario php.....para esto.....tenia un codigo.....el cual fui modificando bastante hasta perder el inicial, el cual me creaba el xml.......pero de todos modos logre crear mi xml con este codigo.

Código :

<? 
$arreglo_nombres=array( 

"TITULO"=>$TITULO = $_POST["TITULO"], 
"LINK"=>$LINK = $_POST["LINK"], 
"RESUMEN"=>$RESUMEN = $_POST["RESUMEN"], 
"NOTICIACOMPLETA"=>$NOTICIACOMPLETA = $_POST["NOTICIACOMPLETA"], 

);  

} 
$buffer='<noticia>';  
            
  while (list ($etiqueta, $valor) = each ($arreglo_nombres)):  
    $buffer.="<$etiqueta>$valor<$etiqueta>";  
  endwhile;  
  $buffer.="</noticia>";  
  
       $archivo = "archivo.xml"; 
       $gestor = fopen($archivo, "a+"); 
       fwrite($gestor, "<?xml version='1.0' encoding='iso-8859-1'?><informacion>"); 
       fwrite($gestor, "$buffer"); 
       fwrite($gestor, "</informacion>"); 
     
<a href='archivo.xml'>XML</a> 

?>


Pero como mi idea es actualizarlo, encontre este codigo, pero no me resulta.

Código :

<? 
$arreglo_nombres=array( 

"TITULO"=>$TITULO = $_POST["TITULO"], 
"LINK"=>$LINK = $_POST["LINK"], 
"RESUMEN"=>$RESUMEN = $_POST["RESUMEN"], 
"NOTICIACOMPLETA"=>$NOTICIACOMPLETA = $_POST["NOTICIACOMPLETA"], 

);  

} 

$buffer='<noticia>';  
            
  while (list ($etiqueta, $valor) = each ($arreglo_nombres)):  
    $buffer.="<$etiqueta>$valor<$etiqueta>";  
  endwhile;  
  $buffer.="</noticia>";  
  $buffer.="</file_xml>";  
  $file=fopen("archivo.xml","w+");  
  fwrite ($file,$buffer);  
  fclose($file); 
     
   if(file_exists("archivo.xml")){ 
       $archivo = "archivo.xml"; 
       $gestor = fopen($archivo, "a+"); 
       fwrite($gestor, "$buffer"); 
       fseek($gestor, 0); 
   } else { 
       $archivo = "archivo.xml"; 
       $gestor = fopen($archivo, "a+"); 
       fwrite($gestor, "<?xml version='1.0' encoding='iso-8859-1'?><informacion>"); 
       fwrite($gestor, "$buffer"); 
       fwrite($gestor, "</informacion>"); 
     
            } 

<a href='archivo.xml'>XML</a> 

?>


Nesesito ayuda por favor.....
esto es lo que nesesito lograr....

Código :

<informacion>
  <noticia>
     <TITULO></TITULO>
     <LINK></LINK>
     <RESUMEN></RESUMEN>
     <NOTICIACOMPLETA></NOTICIACOMPLETA>
  </noticia>
  
  <noticia>
     <TITULO></TITULO>
     <LINK></LINK>
     <RESUMEN></RESUMEN>
     <NOTICIACOMPLETA></NOTICIACOMPLETA>
  </noticia>
  
    <noticia>
     <TITULO></TITULO>
     <LINK></LINK>
     <RESUMEN></RESUMEN>
     <NOTICIACOMPLETA></NOTICIACOMPLETA>
  </noticia>
</informacion>

Por Pablosky

24 de clabLevel



 

Santiago, Chile

msie
Citar            
MensajeEscrito el 06 Dic 2008 07:03 pm
no crees el archivo mejor crea un xml dinamico con el header de xml sale mejor saludos

Por talcual

686 de clabLevel



 

Colombia

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.