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 c开发者_开发知识库hange 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:)
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
精彩评论