all groups > dotnet xml > june 2005 >
You're in the

dotnet xml

group:

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


Should I seriize xml or I should just leave it as text? thanks davidw
6/25/2005 10:22:22 PM
dotnet xml:
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!

Re: Should I seriize xml or I should just leave it as text? thanks davidw
6/26/2005 2:09:29 AM
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?


[quoted text, click to view]

Re: Should I seriize xml or I should just leave it as text? thanks Oleg Tkachenko [MVP]
6/26/2005 11:57:33 AM
[quoted text, click to view]

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

--
Oleg Tkachenko [XML MVP, MCAD]
Re: Should I seriize xml or I should just leave it as text? thanks Oleg Tkachenko [MVP]
6/26/2005 12:22:01 PM
[quoted text, click to view]

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]
Re: Should I seriize xml or I should just leave it as text? thanks davidw
6/26/2005 9:33:09 PM
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?

[quoted text, click to view]

Re: Should I seriize xml or I should just leave it as text? thanks Oleg Tkachenko [MVP]
6/27/2005 11:48:14 AM
[quoted text, click to view]

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]
AddThis Social Bookmark Button