How to change only one part within xml using php?

1

I'm having a hard time getting to that conclusion. I'll explain, I have the dummy xml below:

<url>http://www.example.com/TITULO<url/>

I want to change only the part title, in case it looks like this:

<url>http://www.example.com/OUTROTITULO<url/>

Any idea how to make this change. I do not want to change everything, just the highlighted part.

    
asked by anonymous 11.01.2015 / 03:20

1 answer

1

There are two classes in PHP that will allow you to do this operation.

SimpleXMLElement and DomDocument

I think with the explanation of the PHP manual, there is no need to post examples.

Basic SimpleXML usage

Another tip is that if you are trying to open XML from an existing file, use the simplexml_load_file() function;

    
12.01.2015 / 12:33