views:

22

answers:

1

hello everyone , i have an xml file "Machine.xml" it contains:

<Parameter name="host" value="localhost"/>
<Parameter name="port" value="5900"/>

i would like to change both parameters values using a php script... how can i do that? i mean i want the script to change host's value for example to : value="7.3.4.5" and port value to: value="3124" AND then save the xml file again with these changes.

i tried several ways, but none worked

thx a lot:)

+3  A: 

This question has been asked in many variations before. Search through SO to find out how to do it with DOM and the following XPath

//Parameter[@name="host"]/@value

and

//Parameter[@name="port"]/@value
Gordon
man, I think this is the second time today you have beaten me to the punch while typing...
Tim
@Tim sorry for that :)
Gordon
no problems. I'm just new and trying to give back because SO has helped me learn so much.
Tim