title: XML to LINQ with metadata
body: <p>I'm very new to both XML and LINQ. I've read several XML to LINQ tutorials, but none of the XML documents seem to be formatted the way mine is. I'm not sure if (and how) it changes things.</p>
  
  <p>All the examples I've read on the internet seem to follow this format:</p>
  
  <pre><code>&lt;data&gt;
  &lt;row&gt;
    &lt;Term&gt;201320&lt;/Term&gt;
    &lt;Subj&gt;ACCT&lt;/Subj&gt;
    &lt;Subj_desc&gt;Accounting&lt;/Subj_desc&gt;
  &lt;/row&gt;
  &lt;row&gt;
    &lt;Term&gt;201320&lt;/Term&gt;
    &lt;Subj&gt;ACCT&lt;/Subj&gt;
    &lt;Subj_desc&gt;Accounting&lt;/Subj_desc&gt;
  &lt;/row&gt;
  &lt;/data&gt;
  </code></pre>
  
  <p>If I wanted to read that I think the code would look something like this:</p>
  
  <pre><code>XDocument document = XDocument.Load("URLHERE.xml");
  
  var term = from row in document.Descendants("row")
  select new
  {
  Term = row.Element("Term").Value,
  Subject = row.Element("Subj").Value,
  Subject_Description = row.Element("Subj_desc").Value,
  };
  </code></pre>
  
  <p>Here's the problem: my XML document doesn't follow the same format. Instead of repeating the different tags for each term, it has a set of metadata at the top and then uses the SAME tag for each set of data.</p>
  
  <p>Here's a sample of my XML document:</p>
  
  <pre><code>&lt;metadata&gt;
    &lt;item name="TERM" type="xs:string" length="128"/&gt;
    &lt;item name="SUBJ" type="xs:string" length="128"/&gt;
    &lt;item name="SUBJECT_DESC" type="xs:string" length="512"/&gt;
  &lt;/metadata&gt;
  &lt;data&gt;
  &lt;row&gt;
    &lt;value&gt;201320&lt;/value&gt;
    &lt;value&gt;ACCT&lt;/value&gt;
    &lt;value&gt;Accounting&lt;/value&gt;
  &lt;/row&gt;
  &lt;row&gt;
    &lt;value&gt;201320&lt;/value&gt;
    &lt;value&gt;ACCT&lt;/value&gt;
    &lt;value&gt;Accounting&lt;/value&gt;
  &lt;/row&gt;
  &lt;/data&gt;
  </code></pre>
  
  <p>How would I extract data from it? </p>
  
  <pre><code>var term = from row in document.Descendants("row")
  select new
  {
  Term = row.Element("value").Value,
  Subject = row.Element("value").Value,
  };
  </code></pre>
  
  <p>Doesn't seem right. I'm using C# BTW (not sure if I need to say that or if the tag's sufficient). </p>