- well defined schema
- purely character based data definition method
- customizable tags
- easy validation of XML documents
Generate XML file from dataset
// Connect to database
OleDbConnection con = new OleDbConnection('
// Create new dataset
DataSet ds = new DataSet();
// Create new data adapter
OleDbDataAdapter da = new OleDbDataAdapter();
// Create SQL command
OleDbCommand cmd = new OleDbCommand("SELECT * FROM tblMyData", con);
// Set SQL command to data adapter
da.SelectCommand = cmd;
// Fill dataset
// Write data from dataset to XML file called "YourXMLFile.xml"
Read data from XML file and fill dataset
"WriteXML()" method is used to write XML data from dataset into physical file, memory stream or character stream. In same way you can use "ReadXML()" method to read data from XML file and assigned to dataset.