' Collection of code snippets by Arne Vajhøj ' posted to eksperten.dk, usenet and other places (2002-now) Imports System Imports System.Xml Namespace E Public Class Program Public Shared Sub TopList(fromp As Integer, top As Integer) Console.WriteLine("TopList " & fromp & " " & top) End Sub Public Shared Sub Echo(val As String) Console.WriteLine("Echo " & val) End Sub Public Shared Sub Process(xml As String) Dim doc As New XmlDocument() doc.LoadXml(xml) Dim func As String = doc.SelectSingleNode("/request/function/text()").Value Dim n As XmlNode = doc.SelectSingleNode("/request/parameters") Select Case func Case "TOPLIST" Dim fromp As Integer = Integer.Parse(n.SelectSingleNode("from/text()").Value) Dim top As Integer = Integer.Parse(n.SelectSingleNode("to/text()").Value) TopList(fromp, top) Exit Select Case "ECHO" Dim val As String = n.SelectSingleNode("val/text()").Value Echo(val) Exit Select Case Else Throw New Exception("Unknown function") End Select End Sub Public Shared Sub Main(args As String()) Dim s1 As String = "TOPLIST12" Dim s2 As String = "ECHOABC" Process(s1) Process(s2) End Sub End Class End Namespace