title: Way to list XML entities in SQL Server using xml methods?
body: <p>SQL Server 2005/2008.</p>
  
  <p>I've searched and read several questions here and elsewhere and in BOL, but none I've found so far directly answer this question.</p>
  
  <p>Given</p>
  
  <pre><code>declare @xml xml = '&lt;Root&gt; &lt;Ent foo="abc" bar="def" /&gt; &lt;/Root&gt;'
  </code></pre>
  
  <p>Is there a way to get a result set of something like</p>
  
  <pre><code>col1        col2
  -----------------
  foo         abc
  bar         def
  </code></pre>
  
  <p>I know how to do this by using sp_xml_preparedocument and OPENXML, I'm just wondering if there's a way to do it directly using the xml methods.  I haven't been able to find anything in BOL or Googling, but just wanted to make sure I didn't miss something.</p>
  
  <p>Thanks!</p>