BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
System.XML
System.Xml.XmlComment Class
System.Xml.XmlCharacterData Class
System.Xml.XmlCDataSection Class
System.Xml.XmlAttributeCollection Class
System.Xml.XmlAttribute Class
<< SQL XML
Uncategorized >>

By :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

                If IsNumeric(objReader.Value) Then

                    intValue += System.Xml.XmlConvert.ToInt64(objReader.Value)

                End If

            End If

        End While

        TextBox1.Text = CStr(intValue)


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

Software Developers Needed in Charl
Sr. Software Engineer - Analytics
Immediate Mainframe openings for Ch
Immediate TANDEM-TAL openings for C
Immediate ASP.NET/C# Openings for C

View all Jobs (Add yours)
View all CV (Add yours)



fax server
swimming pool contractor
teleconferencing
water softener
Teleconference
Host Department NOLIMIT Web Hosting
MSN
sunglasses


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP