XML

G

Guest

Hello

I'm trying to save my data to xml via serializing but I'm a bit lost. Below
is my setup at the moment, one project wrapper class that contains general
project info and a list of every node (nodeA, nodeB etc)

namespace xyz
{
public class project
{
public string m_strName;
public string m_strDesc;
public ArrayList nodes;
}
public Base
{
public int m_ID;
// other
}

public nodeA : Base
{
public int m_Type;
public int a;
}

public nodeB : Base
{
public int m_Type;
public int b;
}
}

I'm trying to get a xml file that looks something like this:

<Project
Name = "Local"
Description = "Something"<NodeA
ID = "1"
Type = "A"
a = "1"
/>
<NodeA
ID = "12"
Type = "A"
a = "12"
/>
<NodeB
ID = "21"
Type = "B"
b = "33"
/>
<NodeB
ID = "25"
Type = "B"
b = "12"
/>
</Project>

Appreciate any help.
 
N

Nick Malik [Microsoft]

don't write the code. Write the schema. Let XSD.EXE write the code.
Use that code to both serialize and deserialize.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top