Change line in xml

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
biggipsy
Forum Newbie
Posts: 12
Joined: Tue Apr 08, 2008 6:07 am

Change line in xml

Post by biggipsy »

Hello

I Still search of a solution to change line in xml from php

I change my code

$xml = simplexml_load_file("noticias.xml");


echo $xml->principal->no;

$filho = $xml->addChild('no', '\n' ); // desta forma ela faz o parenteses a seguir <no>

$filho->addChild('marca','vazio');

$filho->addChild('titulo',$_POST['introducao_noticia']);


$filho->addChild('textopequeno',$_POST['texto_pequeno']);



$filho->addChild('textogrande',$_POST['texto_principal']);



$filho->addChild('link',$imagem_nome);



file_put_contents ("noticias.xml", $xml->asXML());

{
header("Location:visualizar_noticias.php");
}


My change is $filho = $xml->addChild('no', "\n" ) and edit the xml this way

<principal>
<no>
<marca>vazio</marca><titulo>a</titulo><textopequeno>a</textopequeno><textogrande>a</textogrande>< link>bc96f61c4311a55bf75d18a283fd6f6b.png</link></no><no>
<marca>vazio</marca><titulo>v</titulo><textopequeno>v</textopequeno><textogrande>v</textogrande>< link>b8f5c489ffdf79a0f3ef4acefb33180f.png</link></no></principal>

but i need change the line after </marca>, after </titulo>, after </textopequeno>, after </textogrande>, after </link> and after </no>

Someone help me? i need to have this done


thanks
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Change line in xml

Post by onion2k »

This is the third time you've posted this question. Once is enough. If you don't get a reply that doesn't mean you can post it again and again until you do.

Use this thread folks - viewtopic.php?f=1&t=81477
Locked