Dot Net: Xml and Dataset
A Dataset is a basket that stores data obtained from data source .This data source can also be XML document .there may be different type of dataset typed or untyped. A typed dataset consists of XML schema .but untyped dataset doesn’t have this type of schema in it. There are so many features that are avail in typed dataset just like we can change XSD file. XML schema is just similar to typed dataset representation and both are available as XSD files. When we store XML document into a Dataset XML schema validate the data that is fetched from XML document.
The XML schema contains whole information about the relation structure .It contains information regarding table, constraints and relation .In .NET XSD file is used to gernate data for the Dataset objects .There are different object that contains methods that enables you to work with XML data . We can also use ADO.NET to transfer data between XML files and dataset objects .This ADO.NET helps us to write dataset data as XML data.ADO.NET also helps to view XML schema and XML document.
Dataset use diffgram to store and preserver all version of data that contains. A Diffgram we know is one of XML format. We can also uses diffgram in other way just like to differentiate between the original and current versions of data. Diffgram contains full information to recreate Dataset .But this diffgram format not helps in populated or recreate XML-schema.
Dataset use diffgram in other way just like use diffgram format to serialize data for transmission across the network. We use ReadXML method of Dataset object to read and load a Dataset from an XML document.Ths method takes two arguments. First argument is XML data and other XMLReadMode argument. There are number of method that’s available in XML relate methods of a Dataset objects.
(1)GetXML:-This method helps us to get data stored in dataset in string variable.
(2)GetXMLscheama:-This method helps to retrieve the XSD schema for XML representation.
(3)ReadXML:-To read data stored in Dataset.
(4)ReadXMLSchema:-this helps to get XSD schema for XML representation.
(5)WriteXML:-To write data to DataSet.
Learn more about Xml Interview Questions