Hmmmm ...
Although it works in most cases, one column has html data in it. It seems that doing this ...
StringBuilder xmltarget = new StringBuilder();
XmlWriter xmlWriter = XmlWriter.Create(xmltarget);
tableData.WriteXml(xmlWriter);
... doesn't identify where this html or binary data exists and wrap the data in cdata tags as it should ...
Is th开发者_运维问答ere something i need to do to ensure the relevant checks are made and a working xml string is produced?
The datatable, I assume that the column with the html in it is just a string? If so then you're going to have to wrap it with the CData tags yourself. I don't think there is any magic in .Net that will do this for you.
I'd be happy to be proven wrong.
Are the columns typed in the dataset?
Investigate the CreateCDataSection
function which is a member of System.Xml.XmlDocument
. It's pretty straightforward.
You may have to convert the datatable to an xml document object prior to writing it out.
精彩评论