Best way to use/keep XML data from file

P

phl

Hi,

I have some data in an xml file which I need to use in my web form. The
data in the xml file needs to be shown in maybe a repeater, grid or
data control. I will need to parse the data make sense of it and maybe
place it in a data structure. Once I have a meaningful representation
of this data(the format is not exactly how i want it), I would like to
cache it. This data does not change often. So my questions are:

- Would it be easier to write code to parse xml or transform it?
- Is is efficient to hold this data in a dataset/datatable or some kind
of XML object and keep it in application cache?

thanks

phl
 
R

Rajesh CKR

In our applications we usually do the following -

class Utility
{

// You may want to consider strongly typed Generic List if you are using
ASP.Net 2.0
static ArrayList xmlData; //contains objects from XML...

static Utility()
{
//Parse the xml file here and put it into a structure which you can
iterate....
loadAndParseXML();
}
}


The static constructor will be called only once and you can expect xmlData
variable to contain the relavent data when required.

Also object in MyXMLData can expose properties so that you can bind on
repeters, datagrids etc. Since you
can write your own logics for Get methodes and also extra properties if
required, this method has an edge over
dataTable or dataset (Still can be done by adding more columns to tables..
but not all that neat)

HTH

Rajesh CKR
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top