在vs2008下怎么获取xml所有子节点的值呢
完全不会,谷歌看了下有些运行不了,大神们,给个操作vs2008中操作xml的代码示例吧,江湖救急啊,多谢多i额
[解决办法]
public static string XMLSerialize<T>(T t)
{
using (StringWriter sw = new StringWriter())
{
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
ns.Add(string.Empty, string.Empty);//Add an empty namespace and empty value
XmlSerializer xz = new XmlSerializer(t.GetType());
xz.Serialize(sw, t, ns);
return sw.ToString();
}
}
public static T XMLDeserialize<T>(string xml) where T : new()
{
T t = new T();
using (StringReader sr = new StringReader(xml))
{
XmlSerializer xz = new XmlSerializer(t.GetType());
return (T)xz.Deserialize(sr);
}
}
[解决办法]
http://www.cnblogs.com/dreamof/archive/2008/08/14/1268096.html