using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml("<root>fdsa</root>");
XmlElement root = doc.DocumentElement;
XmlNodeList xnlist = root.ChildNodes;//获得根节点下的所有节点
foreach(XmlNode xn in xnlist)
{
//遍历每一个节点
string strText= xn.InnerText;//获得节点的值
string strName = xn.Name;//获得节点的元素名称
//..............................
}
}
}
}
DataSet ds = new DataSet();
byte[] byteArray = System.Text.Encoding.Unicode.GetBytes("<?xml version='1.0'?><roots><root><id>1</id><name>张三</name></root><root><id>1</id><name>张三</name></root></roots>");
System.IO.MemoryStream stream = new System.IO.MemoryStream(byteArray);
ds.ReadXml(stream);
DataTable dt = ds.Tables[0];
string strText= xn.InnerText;//获得节点的值
string strName = xn.Name;//获得节点的元素名称
这之后,我要怎么绑定到gridview上呢