Transwiki:XML in ADO.net VB.NET C

XML in ADO.net VB.NET C#.NET

XML is the foundation of .NET. .NET internally represents data as XML and hence can provide interoperability and interaction among applications written in different platforms and languages[.Net compatible].

XmlReader In .Net you can use XML with SqlCommand object. You first create a connection to the sql server database using the SqlConnection object. Then you can use a SqlCommand object with that SqlConnection object to query sql server databases(in XML format). You can use the ExecuteXmlReader method to execute a query. A select operation will return data that can be grabbed into a XMLReader [similar to DataReader object] object. You know that in SqlCommand object you can specify the Query or the stored procedure name to execute. XmlReader object has a Read method like the DataReader object that helps to navigate through the nodes. Mentionable, the query must have FOR XML clause.

XML with DataSet DataSet object has two methods to work with XML. You can use ReadXml to read a XML file or stream. Also, you can use WriteXml to write the contents of the DataSet to a file, stream, or an XmlWriter or TextWriter object.

XmlDataDocument Class You can load XML data into a XmlDataDocument object[from a file or from a dataset]. DOM can be used to manipulate the data. A DataSet containing XML data can also be loaded into a XmlDataDocument object(constructor parameter).

XSLT Transform: XmlDataDocument and XslTransform classes are used to transform XML from one form to another. A XslTransform object contains the style definition and loads a style file using it's Load method. The Transform method of XslTransform transforms XML data according to the style sheet rules. Transform takes a XmlDataDocument[or objectes implemented IXPathNavigable interface] object as a source XML data to transform. Transform also, takes anothor parameter for the destination[a file, stream, XmlWriter, or TextWriter]

All these apply for both VB.net and C#.net. I will provide some code examples in future. Have Fun.