php - SimpleXMLElement Change Attribute Value -


I love - this is very good as an XML element parser. So I'm thinking that there is an XML author - it changes an attribute value, for example,

   

to

  & lt ;? XML version = "1.0"? & Gt; & Lt; A b = "one two" & gt; & Lt; C & gt; Seven & lt; / C & gt; & Lt; D & gt; Eight & lt; / D & gt; & Lt; / A & gt;  

Is there an existing library that does this? Does not provide simple explanation, I'm scared.

Note that I am reading XML from a file, string not

  $ xml = '& lt ;? XML version = "1.0"? & Gt; & Lt; A b = "one two" & gt; & Lt; C & gt; Three four & lt; / C & gt; & Lt; D & gt; Five six & lt; / D & gt; & Lt; / A & gt; '; $ Xml = Simple XMLload_string ($ xml); $ Xml- & gt; C = 'seven'; $ Xml- & gt; D = 'eight'; Echo $ xml- & gt; AsXML ();  

Works!


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -