When a typed DataSet is written to XML using ds.GetXml the columns with null values are removed from the XML. I know this is because the schema is not written etc. but is there a way to override this without having to parse through the DataSet and convert all database nulls to empty string before writing the XML?
EDIT: additional information:
1)My main task is to take the DataSet and stream it to a WebRequest. So I am creating an XML doc
Dim xmldoc As New Xml.XmlDocument()
xmldoc.LoadXml(dsUpload.GetXml)
and then uploading the xmldoc on a HTTpWebRequest(req) like this
Using xw As XmlTextWriter =
New XmlTextWriter(req.GetRequestStream, System.Text.Encoding.Default)
xw.Formatting = Formatting.Indented
xmldoc.WriteTo(xw)
xw.Close()
End Using
2) I am talking about DBNull
3) I need these columns to appear because the site I am uploading to needs all the tags to be included so they can parse it ( must be a legacy system)
EDIT
1) I agree the code is not efficient,but what i failed to mention is the uploading method is generic method in another class. Hence it accepts a XMLDoc because this same method services the upload of dataset as xml and a hardcoded string of XML
2) Yes agree that only the System.String can be transformed to String.Empty.And thats mostly what my dataset has.
3) LOL about the legacy system comment. Here is more ridiculous stuff.I think they probably parse the XML like they would a comma separated file.Anytime there is a comma in the data it throws it off!! :)