Which way to convert to xml

  • Thread starter Thread starter JJ
  • Start date Start date
J

JJ

I've got an n-layer application that fetches data from an SQL database using
stored procedures.
This information is read into various classes which represent a hierachical
structure:.

eg.

public class Page : Base_Page

{

private int _parentPageID;

public int ParentPageID

{

get { return _parentPageID; }

set { _parentPageID = value; }

}

private List<Page> _ChildPages = null;

public List<Page> ChildPages

{

get { return _ChildPages; }

set { _ChildPages = value; }

}


etc,

}



I have just realised that I really need the information to be represented in
XML format. It's hierachical data and I will want to display it in some
hierachical controls.

So, I am wondering which is the best route to take to achieve this.

I understand that I could rewrite the SQLPagesDataprovider in the Data
Access layer completely to read the data directly from the SQL stored
procedure into a dataset and make it hierachical then use GetXML() to
convert it to xml, but is there a way I can add a layer to convert the data
fetched by the current provider (into a new instance of the 'Page' Class)
into XML, without having to rewrite it? I may not always want the data in
XML format, after all.

Hopefully that all makes sense.

JJ
 
Why does it need to be in XML? If it's hierarchical data, it's already
hierarchical data, whether it's in XML or populated in a class structure.

--
HTH,

Kevin Spencer
Microsoft MVP

Help test our new betas,
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
This is new ground for me (as you can see).

How can I make the hierarchical data be the object data source for, say, a
menu control?
Can you use such a class structure to act as a datasource for this control
without having to convert it to XML?

JJ
 
It all depends on what process/class/Control is going to use the data, and
how that consumer is designed.

--
HTH,

Kevin Spencer
Microsoft MVP

Help test our new betas,
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
Back
Top