Link to home
Start Free TrialLog in
Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America

asked on

xml, asp.net

<root>
  <tbl_Fleet><VehicleID>1</VehicleID></tbl_Fleet>
  <tbl_Fleet><VehicleID>2</VehicleID></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
ASKER CERTIFIED SOLUTION
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ITsolutionWizard

ASKER

Below the codes.

#region call the web service
            string sync = ser.GetCoachList(isUpload, path, locationID, passCode);

            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
Are you getting errors?  Can you load the XML Document fine?  What is dataList?