XmlConvert class in VB.NET
In this article I will explain you how to read an XmlConvert Class in ADO.NET.
There are some characters that are not valid in XML documents. XML documents use XSD types, which are different than CLR (.NET) data types. The XmlConvert class contains methods to convert from CLR types to XSD types and vice versa. The DecodeName method transfers an XML name into an ADO.NET object such as DataTable. The EncodeName Method is the reverse of DecodeName: it converts an ADO.NET object to valid XSD name. It takes any invalid character and replaces it with an escape string. Another method, EncodeLocalNAme, converts unpermitted names to valid names.
Besides these three methods, the XmlConvert class has many methods to convert from a string object to Boolean. Byte, integer, and so on. Listing 6-15 shows the conversion from Boolean and Date Time object to XML values.
Listing 6-15 xml convert example
Private Shared Sub Main(ByVal args As String())
Dim writer As New XmlTextWriter("C:\Documents and Settings\PuranMAC\My Documents\Visual Studio 2008\Projects\ConsoleApplication2\ConsoleApplication2\XMLFile1.xml", Nothing)
Dim b1 As Boolean = True
Dim dt As New DateTime(2000, 1, 1)
writer.WriteElementString("test date", XmlConvert.ToString(dt))
Hope this article would have helped you in understanding XmlConvert Class in ADO.NET. See other articles on the website also for further reference.