예제 #1
0
 private ColumnInfoIterator GetTableColumnInfo(string xmlfilename, Func <XmlNodeList> provider)
 {
     //DataTable dt = new DataTable();
     //datacol
     //DataTable dt = new DataTable();
     //using (var nodelist = XMLHelper.GetXmlNodeListByXpath(xmlfilename, "//xml//s:Schema//s:ElementType"))
     using (var nodelist = provider())
     {
         //DataColumn[] colunms = new DataColumn()[nodelist.Count];
         ColumnInfoIterator cii = new ColumnInfoIterator();
         foreach (XmlNode node in nodelist)
         {
             if (node.LocalName == "AttributeType")
             {
                 cii.Add(new ColunmInfo {
                     ColumnKey = node.Attributes["name"].Value, ColumnName = node.Attributes["rs:name"].Value
                 });
                 //dt.Columns.Add(node["name"].Value + node["rs:name"].Value);
                 //dt.Columns.a
             }
         }
         return(cii);
     }
     // return dt;
 }
예제 #2
0
        private DataTable PrepairTableColumn(string xmlfilename)
        {
            DataTable dt = new DataTable();

            ciiterator = GetTableColumnInfo(xmlfilename, delegate {
                return(GetXmlNodeListByXpath(xmlfilename, "//xml//s:Schema//s:ElementType//s:AttributeType"));
            });

            foreach (ColunmInfo ci in ciiterator)
            {
                dt.Columns.Add(ci.ColumnName);
            }
            return(dt);
        }