Cannot add a nested relation or an element column to a table containing a SimpleContent column

前端 未结 4 1341
执念已碎
执念已碎 2020-12-04 01:55

Hi iam write this code

\"

 XmlTextReader read = new XmlTextReader(\"http://msdn.microsoft.com/rss.xml\");
        DataSet ds = new DataSet();
                


        
4条回答
  •  隐瞒了意图╮
    2020-12-04 02:35

    I think this error will display when you are trying to ReadXml from Responsetext from service calls. In this Case Just Fetch the necessary node attribute which you require in outerxml format . Those who are not neccessary skip that element.

    E.g

     var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
                    XmlDocument doc = new XmlDocument();
                    DataSet ds = new DataSet();
                    doc.LoadXml(responseString);
    
                    foreach (XmlNode node in doc.SelectNodes("result/records"))
                    {
                        doc = new XmlDocument();
                        doc.LoadXml(node.OuterXml.ToString());
                    }
    
                    using (XmlReader reader = new XmlNodeReader(doc.DocumentElement))
                    {
                        ds.ReadXml(reader);
                        reader.Close();
                    }
    

    In Above example I want only 'records' node in response stream . So that I am fetching only that & given to dataset for processing.

    I hope it helps!!!!!!!!!!!!!!!!!!!!!!!!!!!

提交回复
热议问题