The XML string in C # cannot be directly bound to the data source, and the direct binding will prompt an error, so we will convert it to the dataset and then use the DataTable in the dataset as the data source-bound control. Look at the following code:
DataSet ds = new DataSet ();
String xmlstr= "XML string literal";
Ds. READXML (New System.IO.MemoryStream System.Text.Encoding.GetEncoding ("Utf-8"). GetBytes (XMLSTR)));
DataTable dt = ds. TABLES[1];
Bound controls. DataSource = DT;
This is the first method, MemoryStream seems to be eliminated, you can use the second method:
String xmlstr= "XML string literal";
XmlTextReader reader = new XmlTextReader (new StringReader (XMLSTR));
DataSet ds = new DataSet ();
Ds. READXML (reader);
DataTable dt = ds. TABLES[1];
Bound controls. DataSource = DT;
After conversion, you can bind, both of these methods can be implemented in C # XML string to do the data source binding to the control.