Is it possible to convert a XML document into a table to displayed dynamically . As my program generates XML during its execution and i need to display the contents of the xml document int the form of a table. As of now i am using a xmlreader parse through the document and put them statically into a datagrid. Is there any better way for doing it.?
Share
The dataset object has a “ReadXml(string filename)” method.
example XML products.xml:
C# snippet:
Although this works, I usually prefer to get my xml into POCO’s and populate the UI grids using a collection of business objects. If datasource changes (you move it to SQL or some other datasource), you can just replace that Data Access component. XDocument in the System.Xml.Linq is very handy for doing this.