如题,比如xml文件如下
<employees>
<employee id= "1 ">
<name> lyred </name>
<city> 广东 </city>
<state> 深圳 </state>
<zipCode> 98122 </zipCode>
</employee>
</employee>
如何把里面的数据生成如下表报
name city state zipcode
lyred 深圳 广东 98122
------解决方案--------------------------------------------------------
把xml读入dataset,然后就可以输出成excel
------解决方案--------------------------------------------------------
StreamReader myStreamReader = new StreamReader(Server.MapPath( "s.xml ")); XmlDataDocument dom = new XmlDataDocument(); dom.DataSet.ReadXmlSchema(myStreamReader); dom.Load(Server.MapPath( "s.xml ")); DataGrid dg = new DataGrid(); dg.DataSource = dom.DataSet; dg.DataBind(); this.Panel1.Controls.Add(dg);注意最后 </employee> 少了个s