一下代码为XML格式<Record Uin="2051" Pwd="" Nick="陈国桢" Name="陈国桢" Face="19" Age="0" Gender="1" Birthday="0" BloodType="5" Constellation="0" Mobile="" HomePage="" Email="" Phone="" Fax="" Address="" PostCode="" Country="" Province="" City="" Memo="" Collage="" MobileType="0" AuthType="0" Dept="" Position="" OpenGsmInfo="0" OpenContactInfo="0" PubOutUin="0" PubOutNick="" PubOutName="" PubOutDept="" PubOutPosition="" PubOutInfo="" OuterPublish="0" LastModifyTime="1253498968" LastLogonTime="1268185124" Deny="0" Allow="2014" LdapUser="0"/>Record 有1K条左右,想获取每个Record下的各个参数,哪位指点一下,ASP语法最好,谢谢各位

解决方案 »

  1.   


    XmlDocument xmldoc = new XmlDocument();        xmldoc.Load(@"E:\WorkProject\WebSite21\XMLFile.xml");        XmlNodeList xmlNodeList = xmldoc.SelectNodes("Record");        DataTable dt = new DataTable();        dt.Columns.Add("Uin", typeof(string));
            //完整Column...        for (int i = 0; i < xmlNodeList.Count; i++)
            {
                DataRow dr = dt.NewRow();
                for (int j = 0; j < xmlNodeList[i].Attributes.Count; j++)
                {
                    dr[j] = xmlNodeList[i].Attributes[j].Value;
                }
                dt.Rows.Add(dr);     
            }        //dt为参数集表