日期:2014-05-18 浏览次数:21523 次
var xml = @"<duliye>
<news>
<id>1</id>
<title>介绍</title>
<content>
介绍介绍介绍介绍介绍介绍介绍
</content>
</news>
<news>
<id>2</id>
<title>团队</title>
<content>
我们的团队我们的团队
</content>
</news>
<news>
<id>3</id>
<title>大事件</title>
<content>
2008年7月
2010年9月
</content>
</news>
</duliye>";
var doc = new XmlDocument();
doc.LoadXml(xml);
var node = doc.SelectSingleNode("/duliye/news[child::id[text()=2]]");//找到id=2的news节点,之后你就可以去它的ChildNodes里取你想要的内容了
Console.WriteLine(string.Format(@"news:
Id={0}
title={1}
content={2}", node.ChildNodes[0].InnerText, node.ChildNodes[1].InnerText, node.ChildNodes[2].InnerText));
------解决方案--------------------
现在的REST WCF的可以做到。。。而且如果数据格式好的话,你可以直接拿到反序列化的Order对象。
在WCF里是WebOperation.Current.IncomingRequest, webservcie的话,我试试。。。
http://blog.csdn.net/fangxinggood/archive/2011/03/14/6247297.aspx