ITsolutionWizard
asked on
xml, asp.net
<root>
<tbl_Fleet><VehicleID>1</V ehicleID>< /tbl_Fleet >
<tbl_Fleet><VehicleID>2</V ehicleID>< /tbl_Fleet >
</root>
Above is the xml structure. When I try to use datalist by adding data source connection to the xml.
It alerts error called "There are multiple root elements'. I can't control the xml out result. See attached for the codes.
How can I fix it?
5-19-2015-2-28-24-PM.png
<tbl_Fleet><VehicleID>1</V
<tbl_Fleet><VehicleID>2</V
</root>
Above is the xml structure. When I try to use datalist by adding data source connection to the xml.
It alerts error called "There are multiple root elements'. I can't control the xml out result. See attached for the codes.
How can I fix it?
5-19-2015-2-28-24-PM.png
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Are you getting errors? Can you load the XML Document fine? What is dataList?
ASKER
#region call the web service
string sync = ser.GetCoachList(isUpload,
XmlDocument doc = new XmlDocument();
doc.LoadXml(sync);
XmlNodeReader xmlReader = new XmlNodeReader(doc);
DataSet ds = new DataSet();
try
{
ds.ReadXml(xmlReader);
if (ds != null)
{
dataList.DataSource = ds;
dataList.DataBind();
}
else
{
dataList.DataBind();
}
}
catch (Exception ex)
{
throw ex;
}
#endregion