The DataSet, DataTable, and DataColumn objects give me some flexibility in the structure of the XML document I create in the WriteXml method, but I need even more control. I want to add a processing instruction to my XML that references my XSL transformation. How do I do this?
You can use the XmlDataDocument object to access the contents of the DataSet as an XmlDocument. You set the EnforceConstraints property of the DataSet to False and then use the XmlDataDocument object to customize the structure of your XML document as you see fit. In this case, you can use the CreateProcessingInstruction method of the XmlDataDocument object, as shown in the following code snippet. Once you’re done, you call ...