title: How to query XML with complex types
body: <p>I am building a program (Visual Studio 2010, .NET 4, C# based console application) to gather specific information from a publicly available government report that is only available as an xml download.  Its structure is similar to the following:</p>
  
  <pre><code>&lt;Collections&gt;
  &lt;Collection&gt;
  &lt;Info id="123456" address="Some Place" name="Some Name"/&gt;
  &lt;Items&gt;
  &lt;Item1/&gt;
  &lt;Item2/&gt;
  &lt;Item3 I3="Y"/&gt;
  &lt;Item3A I3A1="N" I3A2="N" I3A3 = "Y"/&gt;
  &lt;Item3B I3B1="N" I3B2="N"/&gt;
  &lt;Item4/&gt;
  &lt;/Items&gt;
  &lt;/Collection&gt;
  &lt;Collection&gt;...&lt;/Collection&gt;
  &lt;Collection&gt;...&lt;/Collection&gt;
  &lt;/Collections&gt;
  </code></pre>
  
  <p>The full file has hundreds of  blocks and ranges from 50-100mb.  I have never worked with XML formatted even remotely closely to this (it looks awful, right?) and have had a lot of trouble trying to find any examples of queries that are useful.</p>
  
  <p>I need to return the id from the  element for all  nodes that have a "Y" in the elements Item3 through Item3B.  It's driving me a little crazy, because it would be easy if they had matching element names and matching attributes, but they are all unique.  You can't include a wildcard in an XPath query like /Item3*[Q3*="Y"].  </p>
  
  <p>Does anybody have any ideas on how to tackle this?  Thanks!</p>