473,598 Members | 3,252 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 1062
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!P LEASEtkachenko. com> wrote in message
news:ux******** ******@TK2MSFTN GP12.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!P LEASEtkachenko. com> wrote in message
news:Ow******** ******@TK2MSFTN GP12.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
2414
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 any arbitrary data, even binary data such as photos and movies.They are of course also good for their traditional role of storing and manipulating text." This view of strings is about a decade out of date with modern programmimg practice. From...
2
4977
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 haven't found a way to do this. I tried <span style="width:20em"> <input type="text"> <img width="25px" src="...">
6
3661
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 server, has suddenly started running very slowly. The network engineer has thrown up his hands and said "It's Access 97". I've checked out lots of things including the Oplocks setting and other stuff from this NG, and I think I've done everything...
13
2181
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
1017
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 return/line feeds with '<br/>' tags before displaying so it maintains the users original readability as it was input. 1) should I use the ItemCreated or the ItemDataBound event to do this? or should I be using some other event? 2) I'm about to go...
51
3228
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 don't have an agenda, at least not right now. I do plan on writing a few programs. These will be tools I need for firmware testing. They will be relatively simple things like tools for breaking down data by its structure for easy viewing,...
12
5150
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 use of the CSS3 text-shadow property. The side navigation on the pages displays basically as expected in Firefox, Opera and Safari. According to Browsershots, IE7 is also OK for navigation. The desired appearance is as Safari does it (same...
13
3928
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 layout is part of the markup. Cheers, Lister
0
1652
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 these text boxes, set AutoCompleteMode property to SuggestAppend and AutoCompleteSource property set to CustomSource. AutoCompleteCustomSource property is changed in a Leave focus event handlers for each text box, see code below. When I run the...
0
7987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7899
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8392
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8050
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8264
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5850
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3897
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2412
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 we have to send another system
1
1504
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.