473,503 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Should I seriize xml or I should just leave it as text? thanks

Last time, I asked a question about if a XPathDocument could be serialized.
Actually what I really want to know is how should I do in this case:

I have a class that will be serialized. In the class, I need call another
class, which will read setting from database. I want to load the xml once
and use it in the following calls. So it need to be serialized. But
XPathDocument doesn't support it. What should I do here? make the class
serializable? or put the xml in a string and create XPathDocument in every
call, or othe way?

Thanks!
Nov 12 '05 #1
5 1058
davidw wrote:
Last time, I asked a question about if a XPathDocument could be serialized.
Actually what I really want to know is how should I do in this case:

I have a class that will be serialized. In the class, I need call another
class, which will read setting from database. I want to load the xml once
and use it in the following calls. So it need to be serialized. But
XPathDocument doesn't support it. What should I do here? make the class
serializable? or put the xml in a string and create XPathDocument in every
call, or othe way?


Create a serializable class for your settings and use it instead of
XPathDocument.

--
Oleg Tkachenko [XML MVP, MCAD]
http://blog.tkachenko.com
Nov 12 '05 #2
So I should not use the XPathDocument, how should I store those settings?
should I use Hashtable? If I only need some data in the settings, isn't it a
bad idea to parse all data from XML string to Hashtable?
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:ux**************@TK2MSFTNGP12.phx.gbl...
davidw wrote:
Last time, I asked a question about if a XPathDocument could be serialized. Actually what I really want to know is how should I do in this case:

I have a class that will be serialized. In the class, I need call another class, which will read setting from database. I want to load the xml once and use it in the following calls. So it need to be serialized. But
XPathDocument doesn't support it. What should I do here? make the class
serializable? or put the xml in a string and create XPathDocument in every call, or othe way?


Create a serializable class for your settings and use it instead of
XPathDocument.

--
Oleg Tkachenko [XML MVP, MCAD]
http://blog.tkachenko.com

Nov 12 '05 #3
davidw wrote:
So I should not use the XPathDocument, how should I store those settings?
should I use Hashtable? If I only need some data in the settings, isn't it a
bad idea to parse all data from XML string to Hashtable?


Well, I meant not Hashtable, but domain-specific class with meaningful
properties for settings:

public class MySettings {
public string ReportWidth {
get { return ...}
set { .....}
}
...
}

--
Oleg Tkachenko [XML MVP, MCAD]
http://blog.tkachenko.com
Nov 12 '05 #4
Right, but where should I store the setting data, I need load the data from
DB and store it in an object in the class and access it when the class is
called to get a specific setting. I don't want access DB for each setting,
does that make sense?

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:Ow**************@TK2MSFTNGP12.phx.gbl...
davidw wrote:
So I should not use the XPathDocument, how should I store those settings? should I use Hashtable? If I only need some data in the settings, isn't it a bad idea to parse all data from XML string to Hashtable?


Well, I meant not Hashtable, but domain-specific class with meaningful
properties for settings:

public class MySettings {
public string ReportWidth {
get { return ...}
set { .....}
}
...
}

--
Oleg Tkachenko [XML MVP, MCAD]
http://blog.tkachenko.com

Nov 12 '05 #5
davidw wrote:
Right, but where should I store the setting data, I need load the data from
DB and store it in an object in the class and access it when the class is
called to get a specific setting. I don't want access DB for each setting,
does that make sense?


Sure. Load you settings from DB and populate your settings instance. You
can do it in a number of ways - manually, via serialization, etc.

--
Oleg Tkachenko [XML MVP, MCAD]
http://blog.tkachenko.com
Nov 12 '05 #6

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

Similar topics

16
2403
by: Paul Prescod | last post by:
I skimmed the tutorial and something alarmed me. "Strings are a powerful data type in Prothon. Unlike many languages, they can be of unlimited size (constrained only by memory size) and can hold...
2
4974
by: Kai Grossjohann | last post by:
I would like to put a text input field (in the sense of <input type="text">) and an image next to each other, where I know the size in pixels of the image, and I know the total width in em. I...
6
3647
by: Terry Bell | last post by:
We've had a very large A97 app running fine for the last seven years. I've just converted to SQL Server backend, which is being tested, but meanwhile the JET based version, running under terminal...
13
2164
by: ahaupt | last post by:
Hi all, I'm implementing the Clone() method through the ICloneable interface and don't quite know how deep I need to go for a deep copy. Example: class A: ICloneable { object _val;
7
1008
by: djc | last post by:
I am using a repeater control to list 'detail' entries from a simple issue tracking system. These detail entries are MSDE2000 TEXT fields. For each one, I need to replace all the carriage...
51
3196
by: mojosam | last post by:
I've been watching the flame war about licenses with some interest. There are many motivations for those who participate in this sector, so disagreements over licenses reflect those agendas. I...
12
5134
by: Eric Lindsay | last post by:
I have a web page at http://www.architectqueensland.com/index.html styled with http://www.architectqueensland.com/architect.css The site is valid HTML 4.01 Strict. The CSS is valid 2.1 except for...
13
3913
by: lister | last post by:
If I want to move something to a new line, should I be using <br/>, or is there a way of doing it in CSS? I was just thinking if it was possible in CSS then it would be better as otherwise the...
0
1641
by: Builder | last post by:
I made a simple app to test Leave focus event and AutoComplete functionality on the text box control. I added 2 text box controls on the blank form. Then I added Leave focus event handlers for...
0
7282
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,...
1
6998
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
7464
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4680
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3162
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1516
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
741
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
391
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.