CSharp examples for System.Xml:XML Node
Creates columns given an XmlNode.
using System.Diagnostics; using System.Collections.Specialized; using System.Xml; using System.Data; using System;//from w ww . j av a 2 s . co m public class Main{ /// <summary> /// Creates columns given an XmlNode. /// </summary> /// <param name="dt">The target DataTable.</param> /// <param name="node">The source XmlNode.</param> public static void CreateColumns(DataTable dt, XmlNode node) { foreach(XmlAttribute attr in node.Attributes) { dt.Columns.Add(new DataColumn(attr.Name)); } } }