Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/12/2008, 16:31
Avatar de pablosky13
pablosky13
 
Fecha de Ingreso: septiembre-2008
Mensajes: 42
Antigüedad: 15 años, 7 meses
Puntos: 0
...XML....actualizable

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 PHP:
<?
$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 PHP:
<?
$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($gestor0);
   } 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 HTML:
<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> 
Gracias