title: Reading custom machine.config elements using XmlDocument?
body: <p>In machine.config file there are elements written there by 3rd party software so it looks like this:</p>
  
  <pre><code>&lt;configuration&gt;
      &lt;configSections&gt;
      ...
      &lt;/configSections&gt;
  
      ...
  
      &lt;Custom&gt;
          &lt;Level1&gt; ... 
          &lt;/Level1&gt;
  
          &lt;Level2&gt; ... 
          &lt;/Level2&gt;
  
          &lt;Level3&gt;
              &lt;add key="key_text1" value="s1" /&gt;
              &lt;add key="key_text2" value="s2" /&gt;
              &lt;add key="key_text3" value="s3" /&gt;
          &lt;/Level3&gt;
      &lt;/Custom&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I want to get e.g. a value ("s2") of "value" attribute where key="key_text2" from configuration/Custom/Level3 node. So far, I tried to open machine.config as an XML and work from there:</p>
  
  <pre><code>Configuration config = ConfigurationManager.OpenMachineConfiguration();
  XmlDocument doc = new XmlDocument();
  doc.LoadXml(config.FilePath);
  </code></pre>
  
  <p>however, I get XmlException "Data at the root level is invalid.". I also don't know how to use Configuration class methods directly to get this done. Any ideas would be appreciated.</p>