ccot
ccot

Reputation: 1873

modifying xml document using php

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:)

Upvotes: 0

Views: 98

Answers (1)

Gordon
Gordon

Reputation: 317217

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

Upvotes: 3

Related Questions