I have the following XML file
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.6" jmeter="2.11 r1554548">
<hashTree>
<TestPlan ...>
<elementProp name="TestPlan.user_defined_variables" ...>
<collectionProp name="Arguments.arguments">
<elementProp name="nb.publisher_Path" elementType="Argument">
<stringProp name="Argument.name">nb.publisher_Path</stringProp>
<stringProp name="Argument.value">http://mmm.com</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp> ....
And i want to update the URL inside: elementProp name="nb.publisher_Path"
from:http://mmm.com to : http://aaa.com
so i have wrote the following PHP code:
<?php
$xml = new SimpleXmlElement(file_get_contents("C://...Testing_User.jmx"));
$result_publisher_Path_2 = $xml->xpath('//elementProp[@name="nb.publisher_Path"]/stringProp[@name="Argument.value"]')[0];
$result_advertiser_Path = $xml->xpath('//elementProp[@name="nb.advertiser_Path"]/stringProp[2]');
$result_adbrooker_Path = $xml->xpath('//elementProp[@name="nb.adbrooker_Path"]/stringProp[2]');
echo ($result_publisher_Path_2);
(string)$xml->xpath('//elementProp[@name="nb.publisher_Path"]/stringProp[@name="Argument.value"]')[0] = "http://aaa.com";
echo $xml->asXml();
so the result for
echo ($result_publisher_Path_2);
is the right URL which i want to replace, and when i tried to change it with
(string)$xml->xpath('//elementProp[@name="nb.publisher_Path"]/stringProp[@name="Argument.value"]')[0] = "http://aaa.com";
it hasn't been changed.
Any Ideas?