473,406 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

VB.Net Function to create xml string

We are trying to generate the following XML on a client machine:

<Emp EmpId="1" EmpName="Ann">
<Emp EmpId="2" EmpName="Bob">
<Emp EmpId="4" EmpName="Dave" />
<Emp EmpId="5" EmpName="Frank" />
</Emp>
<Emp EmpId="3" EmpName="Cara">
<Emp EmpId="6" EmpName="Jenna" />
<Emp EmpId="7" EmpName="Mike" />
<Emp EmpId="8" EmpName="Tessa" />
</Emp>
</Emp>


The data below contains the Employee Ids (EmpId), Employee Names (EmpName), and Supervisors Employee Id (SupId) to be used in the XML output.

EmpId EmpName SupId
1 Ann 0
2 Bob 1
3 Cara 1
4 Dave 2
5 Frank 2
6 Jena 3
7 Mike 3
8 Tessa 3
* When an employee does not have supervisor, SupId is set to 0.

Public Class ‘emp’ shown here has already been written to store the data hierarchically and generate the needed Xml string.
Public Class emp
Public EmpID As Integer
Public EmpName As String
Public SupID As Integer
Public EmpList As List(Of emp)
Public Function GetXml() As String

Public Class ‘EmpTree’ shown here has already been written and contains sub ‘BuildTree’ which will read all Employee data and create hierarchical data structure in root.
Public Class EmpTree
Public root As emp
Public Sub BuildTree()

Client program code shown here has already been written to generate the XML string.
Dim et As New EmpTree
et.BuildTree()
Dim XmlString as String = et.root.GetXml()


Can someone help me with creating the GetXML() Function?
Nov 3 '10 #1
0 1945

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Derek Hart | last post by:
I wish to execute code from a string. The string will have a function name, which will return a string: Dim a as string a = "MyFunctionName(param1, param2)" I have seen a ton of people...
2
by: Erik Grob \(MCP\) | last post by:
Does anyone know where to find or how to write a quick user defined fucntion that will return a table object when passed the string name of the table object. The reason why I want dynamicallly set...
4
by: Ralph Noble | last post by:
Does anyone know of a string function in Access that will allow me to count the number of instances one string occurs within another? Or if there is some sort of word count function? If there is,...
3
by: Erick Sasse | last post by:
This is not really a C# question, but I'm not sure which is the best group to post it. Please, point me to the right one. What's the best way to create a string from a repeated char? For...
5
by: krbyxtrm | last post by:
Any knows of a Function Signature string Parser? typically one that can parse string: "unsigned int const * __cdecl MyFunction(int,void const *)" into: 0 : 'unsigned int const *' 1 :...
12
by: Ima Loozer | last post by:
OK folks here is what I need help with. Lets assume I have a text field that will contain AlphaNumeric data. There is no set pattern to the field such that any given character can be either alpha...
4
by: Phil Latio | last post by:
I'm kind of looking for some guidance in respect of this obstacle I'm up against - please let me expand; I have an option group with three options (AND, OR, & NONE) and a text box which will...
3
by: =?Utf-8?B?SmFuIEhlcHBlbg==?= | last post by:
Hi, I've a question. I'm developing a windows application and for the application i need to run functions and procedures that are stored in a database. Here is an example that i tried to get...
10
by: james_027 | last post by:
hi, i have a function that I could like to call, but to make it more dynamic I am constructing a string first that could equivalent to the name of the function I wish to call. how could I do...
0
by: rehman | last post by:
Hi, I added reference to COM Component Microsoft ADO Ext. 2.8 for DDL and Security which added a wrapper DLL Interop.ADOX.dll in project references in a web application to create MS Access...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.