el codigo es el siguiente:
Código PHP:
<?php
$library = new SimpleXMLElement('datos.xml', null, true);
$book = $library->addChild('book');
$book->addAttribute('isbn', '0812550706');
$book->addChild('title', "The finished mistery");
$book->addChild('author', 'J. F. Rutherford');
$book->addChild('publisher', 'Watchtower Society');
//header('Content-type: text/xml');
echo $library->asXML();
$library->asXML('library.xml');
?>
Código PHP:
<?xml version="1.0" encoding="iso-8859-1"?>
<bloque>
<noticia>
<titulo>Hola Caracola </titulo>
<autor>KaoS</autor>
<cuerpo>Olla Kaitos a Luisete</cuerpo>
</noticia>
<noticia>
<titulo>Nuevo articulo en desarrolloweb </titulo>
<autor>Raul</autor>
<cuerpo>Jeje hola, aqui estamos </cuerpo>
</noticia>
</bloque>
Código HTML:
Hola Caracola KaoS Olla Kaitos a Luisete Nuevo articulo en desarrolloweb Raul Jeje hola, aqui estamos J. F. RutherfordWatchtower Society Warning: SimpleXMLElement::asXML() [simplexmlelement.asxml]: SAFE MODE Restriction in effect. The script whose uid is 28735 is not allowed to access /www/uuuq.com/f/e/r/fermmm/htdocs owned by uid 2003 in /www/uuuq.com/f/e/r/fermmm/htdocs/manejar1.php on line 11 Warning: SimpleXMLElement::asXML(library.xml) [simplexmlelement.asxml]: failed to open stream: No such file or directory in /www/uuuq.com/f/e/r/fermmm/htdocs/manejar1.php on line 11