title: How to display DataTable XML from WriteXml in a nicely readable format?
body: <p>I have some DataTables that I want to export to a file and then look at. I can use DataTable.WriteXml() to output the contents of the DataTables to XML but what's an easy way to display this data in tabular form? </p>
  
  <p>One suggested way is to transform the XML using XSLT or similar into something readable. I don't have any idea if that's easy or not but that'd be a fine solution if it's easy to use. </p>
  
  <p>An example of the XML I get from WriteXml() for a single DataTable is below. This is for a table named 'RecentMatter' with 10 columns and 3 rows of data. I'd like to have it displayed like a table of data. I'm less concerned about formatting of data values, e.g. converting DateTime values to more readable values. I used the XmlWriteMode.WriteSchema parameter when generating this. If you remove that then all the schema info (before the first  tag) is removed.</p>
  
  <p>Different tables will obviously have different numbers of columns, so any solution would need to deal with that, ideally without having to modify the solution for tables with different columns.</p>
  
  <pre><code>&lt;NewDataSet&gt;
  &lt;xs:schema xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="NewDataSet"&gt;
  &lt;xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="RecentMatter" msdata:UseCurrentLocale="true"&gt;
  &lt;xs:complexType&gt;
  &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
  &lt;xs:element name="RecentMatter"&gt;
  &lt;xs:complexType&gt;
  &lt;xs:sequence&gt;
  &lt;xs:element name="UserLogin"&gt;
  &lt;xs:simpleType&gt;
  &lt;xs:restriction base="xs:string"&gt;
  &lt;xs:maxLength value="2147483647"/&gt;
  &lt;/xs:restriction&gt;
  &lt;/xs:simpleType&gt;
  &lt;/xs:element&gt;
  &lt;xs:element name="MatterNumber"&gt;
  &lt;xs:simpleType&gt;
  &lt;xs:restriction base="xs:string"&gt;
  &lt;xs:maxLength value="2147483647"/&gt;
  &lt;/xs:restriction&gt;
  &lt;/xs:simpleType&gt;
  &lt;/xs:element&gt;
  &lt;xs:element name="ClientName"&gt;
  &lt;xs:simpleType&gt;
  &lt;xs:restriction base="xs:string"&gt;
  &lt;xs:maxLength value="2147483647"/&gt;
  &lt;/xs:restriction&gt;
  &lt;/xs:simpleType&gt;
  &lt;/xs:element&gt;
  &lt;xs:element name="MatterName"&gt;
  &lt;xs:simpleType&gt;
  &lt;xs:restriction base="xs:string"&gt;
  &lt;xs:maxLength value="2147483647"/&gt;
  &lt;/xs:restriction&gt;
  &lt;/xs:simpleType&gt;
  &lt;/xs:element&gt;
  &lt;xs:element name="ClientCode" minOccurs="0"&gt;
  &lt;xs:simpleType&gt;
  &lt;xs:restriction base="xs:string"&gt;
  &lt;xs:maxLength value="2147483647"/&gt;
  &lt;/xs:restriction&gt;
  &lt;/xs:simpleType&gt;
  &lt;/xs:element&gt;
  &lt;xs:element name="OfficeCode" minOccurs="0"&gt;
  &lt;xs:simpleType&gt;
  &lt;xs:restriction base="xs:string"&gt;
  &lt;xs:maxLength value="2147483647"/&gt;
  &lt;/xs:restriction&gt;
  &lt;/xs:simpleType&gt;
  &lt;/xs:element&gt;
  &lt;xs:element name="OfficeName" minOccurs="0"&gt;
  &lt;xs:simpleType&gt;
  &lt;xs:restriction base="xs:string"&gt;
  &lt;xs:maxLength value="2147483647"/&gt;
  &lt;/xs:restriction&gt;
  &lt;/xs:simpleType&gt;
  &lt;/xs:element&gt;
  &lt;xs:element name="Billable" type="xs:boolean"/&gt;
  &lt;xs:element name="ReferenceId" minOccurs="0"&gt;
  &lt;xs:simpleType&gt;
  &lt;xs:restriction base="xs:string"&gt;
  &lt;xs:maxLength value="2147483647"/&gt;
  &lt;/xs:restriction&gt;
  &lt;/xs:simpleType&gt;
  &lt;/xs:element&gt;
  &lt;xs:element name="LastUsed" type="xs:dateTime"/&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  &lt;/xs:choice&gt;
  &lt;/xs:complexType&gt;
  &lt;xs:unique name="Constraint1" msdata:PrimaryKey="true"&gt;
  &lt;xs:selector xpath=".//RecentMatter"/&gt;
  &lt;xs:field xpath="UserLogin"/&gt;
  &lt;xs:field xpath="MatterNumber"/&gt;
  &lt;/xs:unique&gt;
  &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  
  &lt;RecentMatter&gt;
    &lt;UserLogin&gt;PSLTP6\RJK&lt;/UserLogin&gt;
    &lt;MatterNumber&gt;99999-2302&lt;/MatterNumber&gt;
    &lt;ClientName&gt;Test Matters&lt;/ClientName&gt;
    &lt;MatterName&gt;DP Test Matter&lt;/MatterName&gt;
    &lt;ClientCode&gt;99999&lt;/ClientCode&gt;
    &lt;OfficeCode/&gt;
    &lt;OfficeName/&gt;
    &lt;Billable&gt;true&lt;/Billable&gt;
    &lt;ReferenceId/&gt;
    &lt;LastUsed&gt;2011-08-23T23:40:24.13+01:00&lt;/LastUsed&gt;
  &lt;/RecentMatter&gt;
  &lt;RecentMatter&gt;
    &lt;UserLogin&gt;PSLTP6\RJK&lt;/UserLogin&gt;
    &lt;MatterNumber&gt;999991.0002&lt;/MatterNumber&gt;
    &lt;ClientName&gt;Lathe 1&lt;/ClientName&gt;
    &lt;MatterName&gt;LW Test 2&lt;/MatterName&gt;
    &lt;ClientCode/&gt;
    &lt;OfficeCode/&gt;
    &lt;OfficeName/&gt;
    &lt;Billable&gt;true&lt;/Billable&gt;
    &lt;ReferenceId/&gt;
    &lt;LastUsed&gt;2011-07-12T16:57:27.173+01:00&lt;/LastUsed&gt;
  &lt;/RecentMatter&gt;
  &lt;RecentMatter&gt;
    &lt;UserLogin&gt;PSLTP6\RJK&lt;/UserLogin&gt;
    &lt;MatterNumber&gt;999991-0001&lt;/MatterNumber&gt;
    &lt;ClientName&gt;Lathe 1&lt;/ClientName&gt;
    &lt;MatterName&gt;LW Test 1&lt;/MatterName&gt;
    &lt;ClientCode/&gt;
    &lt;OfficeCode/&gt;
    &lt;OfficeName/&gt;
    &lt;Billable&gt;false&lt;/Billable&gt;
    &lt;ReferenceId/&gt;
    &lt;LastUsed&gt;2011-07-12T01:59:06.887+01:00&lt;/LastUsed&gt;
  &lt;/RecentMatter&gt;
  &lt;/NewDataSet&gt;
  </code></pre>