开发者

modifying xml document using php

开发者 https://www.devze.com 2023-01-08 04:21 出处:网络
i have an xml file \"Machine.xml\"it contains: <Parameter name=\"host\" value=\"localhost\"/> <Parameter name=\"port\" value=\"5900\"/>

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
0

精彩评论

暂无评论...
验证码 换一张
取 消