title: Find duplicate child nodes in XML document
body: <p>I have the following XML Document  </p>
  
  <pre><code>&lt;xml&gt;
      &lt;schedule orderno = "1"&gt;
             &lt;item orderno = "1" /&gt;
             &lt;item orderno = "2" /&gt;
             &lt;item orderno = "3" /&gt;
             &lt;item orderno = "2" /&gt;
      &lt;/schedule&gt;
      &lt;scool orderno = "2"&gt;
             &lt;item orderno = "5" /&gt;
             &lt;item orderno = "6" /&gt;
             &lt;item orderno = "1" /&gt;
             &lt;item orderno = "4" /&gt;
      &lt;/scool&gt;
  &lt;/xml&gt;
  </code></pre>
  
  <p>I have inconsistent data in the xml file and need a xpath expression to get the duplicate.</p>
  
  <p>The rule is that the attribute <code>@ordnerno</code> from <code>item</code> in each node <code>scool/schedule</code> must have an unique value. If I have <code>1</code> <code>2</code> <code>3</code> <code>2</code> in <code>schedule</code> the <code>@orderno</code> with the value <code>2</code> duplicate and inconsistent.</p>
  
  <p>I use the XML linq expression library </p>
  
  <pre><code>XDocument.Parse(structure)
           .Descendants("item")
           .Attributes("orderno")
           .GroupBy(g =&gt; g.Value)
           .Where(g =&gt; g.Count() &gt; 1)
  </code></pre>
  
  <p>My solution is suboptimal because it group all nodes, <code>schedule</code> and <code>scool</code>.</p>
  
  <p>The output is <code>1</code> and <code>2</code> but in this case <code>1</code> is not expected.</p>
  
  <p>How can I solve my problem ? </p>