473,382 Members | 1,752 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,382 software developers and data experts.

Which way to convert to xml

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<PageChildPages

{

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

Mar 7 '07 #1
3 1246
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

"JJ" <ab*@xyz.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
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<PageChildPages

{

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

Mar 7 '07 #2
JJ
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

"Kevin Spencer" <un**********@nothinks.comwrote in message
news:Oi****************@TK2MSFTNGP04.phx.gbl...
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

"JJ" <ab*@xyz.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>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<PageChildPages

{

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


Mar 7 '07 #3
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

"JJ" <ab*@xyz.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
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

"Kevin Spencer" <un**********@nothinks.comwrote in message
news:Oi****************@TK2MSFTNGP04.phx.gbl...
>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

"JJ" <ab*@xyz.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>>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<PageChildPages

{

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



Mar 8 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
19
by: Lauren Quantrell | last post by:
I have a stored procedure using Convert where the exact same Convert string works in the SELECT portion of the procedure but fails in the WHERE portion. The entire SP is listed below....
1
by: Logan X via .NET 247 | last post by:
It's official....Convert blows. I ran a number of tests converting a double to an integer usingboth Convert & CType. I *ASSUMED* that CType would piggy-back ontop of Convert, and that performance...
4
by: Eric Lilja | last post by:
Hello, I've made a templated class Option (a child of the abstract base class OptionBase) that stores an option name (in the form someoption=) and the value belonging to that option. The value is...
33
by: baumann.Pan | last post by:
hi all, i want to get the address of buf, which defined as char buf = "abcde"; so can call strsep(address of buf, pointer to token);
4
by: Lerp | last post by:
Hi all, With regards to calling data from a database and filling in an editing form based on some query, which is the best (least intensive on processor) method for assigning the returned...
5
by: Brian Henry | last post by:
Which is faster or considered the better way to do this. I have a object that holds a date... Convert.ToDate(object) or Directcast(object,DateTime) ? Thanks
4
by: mcmreddy | last post by:
Hi! Is there a way to convert application id ( db2 list applications output) to a readable format?. Auth Id Application Appl. Application Id DB # of Name ...
6
by: Tony | last post by:
Hello! It seems to me that both Int32.Parse(..) and Convert.ToInt32(...) static methods works in exactly the same way. Both can throw an exeption. So is it any different at all between these...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?

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.