DataSet.WriteXML Issue
-
Hey All, My problem is that sending XML from a web service to client works fine. Using the exact same steps to send that XML back causes a crash! The web service returns the xml string
DataSet dsReturn; ... returnWriter = new StringWriter(); dsReturn.WriteXml(returnWriter, XmlWriteMode.WriteSchema); return returnWriter.ToString();
The client reads the xml stringDataSet Budget; ... srWebService = new StringReader(m_wsBudget.Select("SelectWorksheetbyYearMediaCategory", sYear + "," + sMedia + "," + sCategory)); xmltrWebService = new XmlTextReader(srWebService); xmlrsService = new XmlReaderSettings(); xmlrWebService = XmlReader.Create(xmltrWebService, xmlrsService); Budget.ReadXml(xmlrWebService);
This interaction works fine all the time. Using the exact same steps to send that XML back to the web service crashes. For the sake of testing, both Web Service and Client are on the same computer (my development machine). The exception is: System.Xml.XmlException: Unexpected end of file has occurred. The following elements are not closed: Comment, HeaderModify, NewDataSet. Line 525, position 31. This follows immediately after a '#' character in the Comment field of a datatable. Any advice as to why it works coming from the web service but not sending to it (the Comment field never changed)? Is there another way to easily wrap up the XML from a dataset properly? I would assume .WriteXML() would take care of formatting special characters automatically :wtf: Thanks, Pualee