Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :
03/24/2008
Times viewed :
249
The System.Xml.XmlConvert Class
Supported Versions
.NET Framework 1.0, 1.1, 1.2
Public Members
Bold members are covered in the sample code.
Public Properties
Public Methods
DecodeName
EncodeLocalName
EncodeName
EncodeNmToken
Equals
FromBinHexString
GetHashCode
GetType
ToBinHexString
ToBoolean
ToByte
ToChar
ToDateTime
ToDecimal
ToDouble
ToGuid
ToInt16
ToInt32
ToInt64
ToSByte
ToSingle
ToString
ToTimeSpan
ToUInt16
ToUInt32
ToUInt64
VerifyName
VerifyNCName
Overview
This convenient class supplies a series of conversion
methods that deal with the mapping of .NET and XML Schema data types. For
example, when retrieving values from XML documents, XMLConvert's "To"
methods can be used to convert values to one of a number of supported .NET data
types.
Example (VB.NET):
How to use the XMLConvert.ToInt64 method to convert a textual value into a 64-bit
signed integer.
This example uses the XMLTextReader.Read and
XMLTextReader.MoveToContent methods to read through all the elements in a
sample XML document. It then uses the XMLNodetype.Text property to see which
contain numeric values. The XMLConvert.ToInt64 method is then used to convert
each of the selected values to 64-bit signed integers. These values are added
together, and the final total is then displayed.
Dim objReader As New
System.Xml.XmlTextReader("C:\sample.xml")
Dim intValue As Integer
While objReader.Read()
objReader.MoveToContent()
If objReader.NodeType = System.Xml.XmlNodeType.Text
Then