如何将字符串转换为节点列表 [英] how to convert string to nodelist
本文介绍了如何将字符串转换为节点列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图通过加载xml文档来调用Web服务.我的代码是
i tried to invoke the webservice by loading an xml document.my code is
public string getitems()
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(@"D:satish\satti.xml");
XmlNode root = doc.DocumentElement;
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("bk", "http://www.w3.org/2005/Atom");
XmlNodeList nodelist = root.SelectNodes("//item",nsmgr );
return nodelist.tostring();
}
当我使用此Web服务时,
when i used this webservice ,
ConsoleApplication1.ServiceReference1.Service1Client proxy = new ConsoleApplication1.ServiceReference1.Service1Client();
DataSet ds = proxy.getdata();
俗话说不能将字符串转换为system.data.dataset.
我想做的就是从xml文档中创建一个Webservuce,
its saying cant convert string to system.data.dataset.
what exactly i wanted to do is i want make an webservuce from an xml document,
推荐答案
您需要检查proxy.getdata();
返回的内容.
它可能返回一个字符串-在这种情况下,您无法将其转换为数据集.
您将需要修改getdata()
方法,以便它返回适当的数据集.
You need to check what theproxy.getdata();
returns.
It may be returning a string - in which case you cannot convert it into a dataset.
You will need to modify thegetdata()
method so that it returns an appropriate dataset.
这篇关于如何将字符串转换为节点列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文