Hi iam write this code
"
XmlTextReader read = new XmlTextReader("http://msdn.microsoft.com/rss.xml");
DataSet ds = new DataSet();
ds.ReadXml(read);
ListView1.DataSource = ds.Tables[4];
ListView1.DataBind(); "
and this error is happing
"Cannot add a nested relation or an element column to a table containing a SimpleContent column"
Your problem is you have the same element name with a different structure somewhere in the document.
So, for example, if you have
<Item>Bicycle</Item>
and later in the document you have
<Item Type="Sports"><Name>Bicycle</Name></Item>
The XSD will fail to generate a proper schema for the second Item attribute structure because it's already defined Item as a SimpleContent column based on the earlier declaration.
The solution is to (naturally) avoid using the same element name for different structures within your XML. Obviously in your case that's kind of inconvenient since Microsoft owns the XML in question (hypothetically, since the comment from Deni indicates this site no longer exists.) You'd have to use XMLWriter or some variant to swap out the name of the offending element for something unique.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With