title: XML to ListView
body: <p>I have made a script in C# that should load data from a XML file into a ListView.</p>
  
  <p>This is the XML file I used to test : </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Items&gt;
      &lt;wordExample languageOne="Пока" languageTwo="Doei" languageThree="Goodbye" /&gt;
      &lt;wordExample languageOne="1" languageTwo="2" languageThree="3" /&gt;
      &lt;wordExample languageOne="4" languageTwo="5" languageThree="6" /&gt;
      &lt;wordExample languageOne="7" languageTwo="8" languageThree="9" /&gt;
  &lt;/Items&gt;
  </code></pre>
  
  <p>Now I get an error when I try to load the XMl into the ListView and I really don't know what it could be, this is actually the first time I try to use XML in C#.</p>
  
  <p>This is the code used to load the XML into the ListView :</p>
  
  <pre><code>public void ImportXMLToListView(ListView listview)
  {
      DialogResult dr = OPEN_FILE_DIA.ShowDialog();
  
      if (dr == DialogResult.OK)
      {
          XDocument doc = XDocument.Load(OPEN_FILE_DIA.FileName);
  
          int counter = 0;
  
          foreach (var dm in doc.Descendants("Items"))
          {
              string tmpOne = dm.Attribute("languageOne").Value;
              string tmpTwo = dm.Attribute("languageTwo").Value;
              string tmpThree = dm.Attribute("languageThree").Value;
  
              counter++;
  
              ListViewItem lvi;
  
              lvi = new ListViewItem(tmpOne);
              lvi.SubItems.Add(tmpTwo);
              lvi.SubItems.Add(tmpThree);
  
              listview.Items.Add(lvi);
          }
      }
  }
  </code></pre>
  
  <p>Am I doing something wrong??
  This is the error I get : (Object reference not set to an instance of an object.)
  <img src="https://i.stack.imgur.com/6objj.png" alt="Screenshot of the error"></p>
  
  <p>Please tell me what I do wrong I really try to understand :S</p>