XML : XML File changing contents

First off, the answer might be very simple, but I've tried many many normal seeming solutions and haven't got them working no matter what I tried.

I got this XML file:

  <?xml version="1.0" encoding="utf-8"?>      <Config>        <PopulationSize>100</PopulationSize>        <SpecieCount>20</SpecieCount>        <Activation>          <Scheme>FixedIters</Scheme>          <Iters>1</Iters>        </Activation>        <ComplexityRegulationStrategy>Absolute</ComplexityRegulationStrategy>        <ComplexityThreshold>500</ComplexityThreshold>        <Description>          Helikopter game        </Description>        <Timesteps>50000</Timesteps> //Length of the world (x-axis)        <Worldheight>200</Worldheight> //Height of the world (y-axis)        <SensorInputs>10</SensorInputs> //Length of one side of the rectangle that is used as the input. So 15 here means 15*15 = 225 inputs        <Speler>computer</Speler>      </Config>    

And I want to edit the

      <Speler>computer</Speler>    

to something like

      <Speler>mens</Speler>    

Currently, I want something along the lines off:

          XmlDocument doc = new XmlDocument();          doc.Load("Helikopter.config.xml");          //Change the contents of "Speler" to "Mens"          doc.Save("Helikopter.config.xml");    

But I just can't seem to get it working, no matter what I try to put there, I've tried a lot of options on here already.

Help is appriciated, thanks

No comments:

Post a Comment