title: Create or replace node in an XML without root in C#
body: <p>I have an XML file like this:</p>
  
  <pre><code>&lt;Something&gt;....&lt;/Something&gt;
  &lt;Another&gt;....&lt;/Another&gt;
  &lt;Other&gt;...&lt;/Other&gt;
  </code></pre>
  
  <p>This XML file does not have a root element (I know that this is a wrong XML format).</p>
  
  <p>I need to create or replace (if it already exists) a node in this XML, but I can't work with <code>XDocument</code> or <code>XmlDocument</code> because they need a root element to work, and I can't add a root element to this XML because I can't change more code in the Application (Windows forms application).</p>
  
  <p>What are my options to perform this?</p>
  
  <p>Edit 1:
  Using @chridam's sample, I have this method, but it replaces the entire XML. What do I need to change?</p>
  
  <pre><code>public void ReEscribirNodoXML(string pathXml, string nodoName, string nodeContent)
  {
      if (File.Exists(pathXml))
      {
          XmlValidatingReader vr = new XmlValidatingReader(pathXml, XmlNodeType.Element, null);
          while (vr.Read())
          {
              Debug.WriteLine("NodeType: {0} NodeName: {1}", vr.NodeType, vr.Name);
          }
  
          XmlWriterSettings settings = new XmlWriterSettings();
          settings.Indent = true;
          settings.OmitXmlDeclaration = true;
          settings.NewLineOnAttributes = true;
  
          var writer = XmlWriter.Create(pathXml, settings);
          writer.WriteStartElement(nodoName);
          writer.WriteRaw(nodeContent);
          writer.WriteEndElement();
  
          writer.Flush();
      }
      else
      {
          throw new Exception("I#Error");
      }
  }
  </code></pre>