title: C# DataGridView binding to subset of XML
body: <p>I need to populate a DataGridView conditionally. The data comes from one XML file, e.g.</p>
  
  <pre><code>&lt;?xml version="1.0" standalone="yes"?&gt;
  &lt;people&gt;
    &lt;person&gt;
      &lt;name&gt;Bob&lt;/name&gt;
      &lt;dogs&gt;
        &lt;dog&gt;&lt;name&gt;Rover&lt;/name&gt;&lt;/dog&gt;
        &lt;dog&gt;&lt;name&gt;Rex&lt;/name&gt;&lt;/dog&gt;
      &lt;/dogs&gt;
    &lt;/person&gt;
    &lt;person&gt;
      &lt;name&gt;Jim&lt;/name&gt;
      &lt;dogs&gt;
        &lt;dog&gt;&lt;name&gt;Duke&lt;/name&gt;&lt;/dog&gt;
        &lt;dog&gt;&lt;name&gt;Colin&lt;/name&gt;&lt;/dog&gt;
        &lt;dog&gt;&lt;name&gt;Gnasher&lt;/name&gt;&lt;/dog&gt;
      &lt;/dogs&gt;
    &lt;/person&gt;
  &lt;/people&gt;
  </code></pre>
  
  <p>If I use the following code I can show all dogs in the DataGridView - but I need to restrict the list to those owned by specific people.</p>
  
  <pre><code>DataSet ds = new DataSet();
  ds.ReadXml("data.xml");
  
  dataGridView1.DataSource = ds;
  dataGridView1.DataMember = "dog";
  </code></pre>
  
  <p>How do I do this?</p>
  
  <p>Thanks
  Stuart</p>