Logo      
 
Total Source Downloaded: 133,409
 
Total Snippet Views: 70,672
 
New Member: doyoursoft
     
Home Tutorials Register Members Submit Snippet  
My Account
Username
Password
Site Information
Members
463
Total Downloads
99
Total Snippets
90
Downloads
C#
80
Visual Basic.Net
19
Snippets
C#
63
Visual Basic.Net
27
Submit your source code and code snippets to Cy2online and help build an archive of source code. Click here register or login if you are a member.
Submit Snippets
Visual Basic.NetXMLGet Elements By Tag Name
Viewed: 856
Version: Framework 3.0
This code snippet shows how to use GetElementsByTagName() method to get element data.
Import/Using Directives
Imports System.Xml Imports System.Xml.Serialization Imports System.IO
Imports System.Xml
Imports System.Xml.Serialization
Imports System.IO

Public Class XMLExample

         Public Shared Sub Main()
                  Dim rawXML As String = _
                  "<Company>" & _
                  "  <Employee>" & _
                  "    <name>John</name>" & _
                  "    <Id>1</Id>" & _
                  "    <email>John@xxxxxx.com</email>" & _
                  "  </employee>" & _
                  "  <employee>" & _         
                  "    <name>Sue</name>" & _
                  "    <Id>2</Id>" & _
                  "    <email>Sue@xxxxxx.com</email>" & _
                  "  </employee>" & _
                  "</Company>"

                   Dim xmlDoc As New XmlDocument
                  Dim employeeNodes As XmlNodeList
                  Dim employeeNode As XmlNode
                  Dim baseDataNodes As XmlNodeList
                  Dim bFirstInRow As Boolean

                  xmlDoc.LoadXml(rawXML)

                  employeeNodes = xmlDoc.GetElementsByTagName("employee")
                  For Each employeeNode In employeeNodes
                            baseDataNodes = employeeNode.ChildNodes
                           bFirstInRow = True
                  
                           For Each baseDataNode As XmlNode In baseDataNodes
                                    If (bFirstInRow) Then
                                             bFirstInRow = False
                                    Else
                                             Console.Write(", ")
                                    End If
                           Console.Write(baseDataNode.Name & ": " & baseDataNode.InnerText)
                           Next
                 Next
            End Sub
End Class
New Snippets
    Title Language Views
1 How to get list of network SQL Server. C# 102
2 Simple MD5 Example Visual Basic.Net 141
3 Memory Stream Writer and Reader Visual Basic.Net 195
4 Save Encrypted Passwords To Database C# 295
5 Download Data From A URI Visual Basic.Net 217
6 Square Root Visual Basic.Net 123
7 Check File IO Permission Visual Basic.Net 128
8 Save An Image To PNG File Visual Basic.Net 173
9 Add Element To An ArrayList Visual Basic.Net 218
10 Check File Attribute C# 333
1 Simple DataGridView Example - C#
This example demonstrates how to load data into the DataGridView control using string array's.
2 A Custom Message Box - C#
This example source code demonstrates how you can develop your own messages box.
3 Custom MessageBox 2 - C#
This example source code builds on a previous example of creating a custom MessageBox. New features in this example include different types of buttons and displaying an icon. Also uses different message beep tones for standard MessageBox's and warring MessageBox's.
4 Connect To MSN Messenger Using The MSN Protocol - C#
This sample application demonstrates how to connect to MSN Messenger using the MSN Protocol. It also includes how to generate a Ticket that is used with the ChallengeString. This is a simple authentication example.
5 Send Messages Using The Net Send Command - C#
This sample program demonstrates how to send messages in a network using the Windows Messenger service.
1 Read Image File As bytes - C#
This sinppet opens an image for reading as bytes. The bytes are then placed into a memorystream which is used to create a bitmap image of the bytes. The image is then set as the forms background image.
2 Retrieve the path of a file, using openfiledialog - C#
This snippet uses the openfiledialog class to get a files path. Useful for opening files from a location on the harddrive.
3 Load web image into picturebox - Visual Basic.Net
Function with picturebox and url as argument to display the passed url to image inside a picturebox I got this from freevbcode a while back.
4 Random Number Generator - Visual Basic.Net
Function that reurns a random non-repeating integer
5 Fade-In Splash Screen - Visual Basic.Net
Fade-in or Fade-out your Splash Screen
CY2 Online2.net | CopyRight 2005 - 2007 | All Rights Reserved