Ver Mensaje Individual
  #2 (permalink)  
Antiguo 09/03/2014, 20:15
taurojo
 
Fecha de Ingreso: enero-2014
Ubicación: alicante
Mensajes: 28
Antigüedad: 10 años, 3 meses
Puntos: 1
De acuerdo Respuesta: SimpleXML y array

Me autorespondo.

Al final era cuestión de salir y dar una vuelta con la familia, sentarse y revisar conceptos....

Seguro que a alguien le servirá. Aquí cambio tanto atributos como contenidos.

Espero que a alguien le sirva.


Si tenéis alguna apreciación ;D o mejora. solo tener en cuenta que esto está pensado para tener un formulario y que cree nuevos xml con los datos que se "ingestan".

Un saludo a todos.


Código PHP:

<?php

 
//CARGAMOS EL XML BASE:
$xml simplexml_load_file('basehybrid.xml'); 
         
////si queremos visionar la estructura
echo('<pre>');
print_r($xml);
echo(
'</pre>');


///CAMBIAMOS TITULO DEL EPG DESCRIPCIÓN1
$xml->Content->EpgDescription[0]->EpgElement 'DESCRIPCIÓN1';
///CAMBIAMOS TITULO DEL EPG DESCRIPCIÓN2
$xml->Content->EpgDescription[1]->EpgElement[0] = 'DESCRIPCIÓN2';
///CAMBIAMOS TITULO DEL EPG Apect-ratio
$xml->Content->EpgDescription[1]->EpgElement[1] = 'Aspect';
///CAMBIAMOS TITULO DEL EPG Rating
$xml->Content->EpgDescription[1]->EpgElement[2] = 'Rating';
///CAMBIAMOS TITULO DEL EPG Copyright
$xml->Content->EpgDescription[1]->EpgElement[3] = 'Copyright';
///CAMBIAMOS TITULO DEL EPG Description
$xml->Content->EpgDescription[1]->EpgElement[4] = 'Description';
///CAMBIAMOS TITULO DEL EPG Synopsis
$xml->Content->EpgDescription[1]->EpgElement[5] = 'Synopsis';


///CAMBIAMOS LOS ATRIBUTOS DE LAS FECHAS

$xml->Content->Content->attributes()->startDate ='esta fecha se cambia';
$xml->Content->Content->attributes()->expiryDate ='esta fecha se cambia';





/// Guardamos el xml
$xml->asXml("test2.xml");