title: How to Replace XML Node Using R
body: <p>I am using package "XML" to create an XML file in R.</p>
  
  <p>Here is my R code.</p>
  
  <pre><code>library(XML)
  xmlWARN &lt;- xmlParse(strWarningXMLFileName)
  xmlWARN &lt;- xmlRoot(xmlWARN)
  newXMLNode("StartDateTime", format(min(MyData$timestamp),"%m/%d/%Y %H:%M"), parent = xmlWARN)       
  newXMLNode("EndDateTime", format(max(MyData$timestamp),"%m/%d/%Y %H:%M"), parent = xmlWARN)
  newXMLNode("Granularity", strGranularity, parent = xmlWARN)
  newXMLNode("TimeGapInData",blnTimeSlotGaps , parent = xmlWARN)
  newXMLNode("TimeGapInDataIntervals",intNumberOfMissingTimeslots , parent = xmlWARN)
  newXMLNode("IncompleteTimespan",blnIncompleteTimeSpan , parent = xmlWARN)
  saveXML(xmlWARN, strWarningXMLFileName)
  </code></pre>
  
  <p>This creates my XML file below just fine.</p>
  
  <pre><code>&lt;Server-Block&gt;
    &lt;Platform&gt;LINUX&lt;/Platform&gt;
    &lt;ServerName&gt;MyServer&lt;/ServerName&gt;
    &lt;StartDateTime&gt;08/12/2017 00:00&lt;/StartDateTime&gt;
    &lt;EndDateTime&gt;08/12/2017 11:00&lt;/EndDateTime&gt;
    &lt;Granularity&gt;1-minute&lt;/Granularity&gt;
    &lt;TimeGapInData&gt;FALSE&lt;/TimeGapInData&gt;
    &lt;TimeGapInDataIntervals&gt;0&lt;/TimeGapInDataIntervals&gt;
    &lt;IncompleteTimespan&gt;FALSE&lt;/IncompleteTimespan&gt;
    &lt;AtLeastOneThresholdExceeded&gt;TRUE&lt;/AtLeastOneThresholdExceeded&gt;
    &lt;LinuxCPUUtilizationPercentCollected&gt;TRUE&lt;/LinuxCPUUtilizationPercentCollected&gt;
    &lt;LinuxCPUUtilizationPercentWithoutWIOThresholdMaximum&gt;80&lt;/LinuxCPUUtilizationPercentWithoutWIOThresholdMaximum&gt;
    &lt;LinuxCPUUtilizationPercentWithoutWIOThresholdMaximumExceeded&gt;TRUE&lt;/LinuxCPUUtilizationPercentWithoutWIOThresholdMaximumExceeded&gt;
    &lt;LinuxCPUUtilizationPercentWithoutWIOThresholdMaximumReached&gt;98.887&lt;/LinuxCPUUtilizationPercentWithoutWIOThresholdMaximumReached&gt;
    &lt;LinuxCPUUtilizationPercentWithoutWIOThresholdAverageReached&gt;9.04793040847201&lt;/LinuxCPUUtilizationPercentWithoutWIOThresholdAverageReached&gt;
    &lt;LinuxCPUUtilizationPercentWithoutWIOThresholdMaximumReachedCount&gt;25&lt;/LinuxCPUUtilizationPercentWithoutWIOThresholdMaximumReachedCount&gt;
    &lt;StartDateTime&gt;08/12/2017 00:00&lt;/StartDateTime&gt;
    &lt;EndDateTime&gt;08/12/2017 11:00&lt;/EndDateTime&gt;
    &lt;Granularity&gt;1-minute&lt;/Granularity&gt;
    &lt;TimeGapInData&gt;FALSE&lt;/TimeGapInData&gt;
    &lt;TimeGapInDataIntervals&gt;0&lt;/TimeGapInDataIntervals&gt;
    &lt;IncompleteTimespan&gt;FALSE&lt;/IncompleteTimespan&gt;
  &lt;/Server-Block&gt;
  </code></pre>
  
  <p>The only thing I cannot figure out is how to replace the value for a node.</p>
  
  <p>For instance change:</p>
  
  <pre><code>&lt;ServerName&gt;MyServer&lt;/ServerName&gt;
  </code></pre>
  
  <p>to</p>
  
  <pre><code>&lt;ServerName&gt;YourServer&lt;/ServerName&gt;
  </code></pre>
  
  <p>Any advice would be appreciated.</p>
  
  <p>Thanks,</p>
  
  <p>Lou</p>