0

I have some xml data in file which I want to extract and write the user's input back in xml format. I want to extract and change the data highlighted in bold.

Kindly find below xml data :

  <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="MP Search ZA - Auth User" enabled="true">
    <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
      <boolProp name="LoopController.continue_forever">false</boolProp>
      <intProp name="LoopController.loops">-1</intProp>
    </elementProp>
    <stringProp name="ThreadGroup.num_threads">**1**</stringProp>
    <stringProp name="ThreadGroup.ramp_time">**2**</stringProp>
    <longProp name="ThreadGroup.start_time">1402264500000</longProp>
    <longProp name="ThreadGroup.end_time">1402265700000</longProp>
    <boolProp name="ThreadGroup.scheduler">true</boolProp>
    <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
    <stringProp name="ThreadGroup.duration">**3960**</stringProp>
    <stringProp name="ThreadGroup.delay">**0**</stringProp>
  </ThreadGroup>

I am looking for a php solution.

user4021949
  • 243
  • 5
  • 13
  • 2
    [Let's go!](http://php.net/manual/en/class.simplexmlelement.php) Don't waste any time, you can start right now – Rizier123 Apr 01 '15 at 10:45
  • 2
    Personally I prefer `DOMDocument` (with `DOMXPath`) but that's just me :P http://php.net/manual/en/class.domdocument.php – CD001 Apr 01 '15 at 10:47
  • how about giving it a try yourself and then asking questions when you are stuck, but "goggling" a bit beforehand sure does not harm :) – hexerei software Apr 01 '15 at 10:55
  • This works very similar to [Simple PHP editor of text files](http://stackoverflow.com/q/8226958/367456), you perhaps just miss the reference question on parsing XML? [How do you parse and process HTML/XML in PHP?](http://stackoverflow.com/q/3577641/367456) – hakre Apr 01 '15 at 21:23

0 Answers0