title: Standard way to instantiate objects from an xml config file
body: <p>QUESTION: How can I instantiate a model based on a config file?</p>
  
  <p>BACKGROUND: I have a model simulator application consisting of dozens of different types of objects, each composed of other objects (in a complex compositional hierarchy). I would like to be able to instantiate the model based on an external configuration file. Is there a "standard approach" for this sort of task?</p>
  
  <p>So for example, if I had a config.xml file like this:</p>
  
  <pre><code>&lt;site&gt;
      &lt;facility name="F1"&gt;
          &lt;tank name="t1"/&gt;
          &lt;pipe name="p1"/&gt;
      &lt;/facility&gt;
      &lt;facility name="F2"&gt;
      ...
  </code></pre>
  
  <p>I want a <code>Configurator</code> that can parse that file and create a Site object composed of a collection of Facility objects composed of various Tank &amp; Pipe equipment, etc. (Eventually I will also do this in reverse to persist the model.) The model configuration will change frequently; users will collect many different versions of the config file.</p>
  
  <p>Here are some options I've seen suggested, but I haven't used any of these tools much yet, and I'm hoping to get some advice as to which (if any) of these approaches might be most appropriate for this problem.</p>
  
  <ol>
  <li>Role my own xml config file, parse it using XmlTextReader, and instantiate the model using reflection to map strings to types. (But is this re-inventing the wheel?)</li>
  <li>Use ConfigurationManager from <code>System.Configuration</code>, storing settings in app.config. (But not sure how to support the "many different versions of the config file" requirement.)</li>
  <li>Use XmlSerializer. (But I understand this requires default constructors, which would rule out constructor-based Dependency Injection which I had hoped to use.)</li>
  <li>Use an IoC Container. (But I have several inexperienced programmers who will be interacting with the program; I'd rather not overwhelm them with unnecessary complexity.)</li>
  </ol>
  
  <p>(Bottom line: I hope to "do the simplest thing that could possibly work". But my unfamiliarity with these tools prevents me from determining which one is simplest.)</p>