开发者

rss feed using C# and gridview

I'm trying to read an xml file from a url and print the contents to a data grid to build a 开发者_JS百科simple rss feed, here is my code:

XmlTextReader reader = new XmlTextReader("url to an xml file");
DataSet ds = new DataSet();
ds.ReadXml(reader);
gridview1.DataBind();

what i'm getting is an exception saying: "Cannot add constraint to DataTable 'a' which is a child table in two nested relations."

what does that mean? what am i doing wrong???


I believe XML instances where subnodes have the same name are not fully supported. Does your XML have any child nodes with the same name as any ancestor nodes?

Edit: this article might somewhat help you http://www.codeproject.com/KB/cpp/dataset.aspx. Though it is in Managed C++, the logic is the same.


Check out this little guy: XML Inference Problem

The problem is that there are two elements with identically named child nodes. It seems that this is a known issue with VS. You could always try getting the information into XSD format or writing your own XML schema to work with the feed?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜