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

Save Application State to XML: How to have each module create a "Node"?

Hi,

I have an application which is built from many modules. I re-use the
modules in different applications.

I'd like to have each of my modules implement a "SaveState()" method.
The method should return the state of the module (and any modules it
contains) in some nice, easily parsable and savable format. I think
this format should be XML.

So should each module return an XmlElement, an XmlDocument, or an
XmlDocumentFragment. I've been experimenting and I can't figure out
the best way to do this. I'd like to do it "right" because I'll be
doing this a lot.

The application would collect all the xml "chunks" from each of the
modules and assemble them into a single .xml file on the disk. I
assume this means all the chunks need to be made part of an
XmlDocument.

Advice? Pointers? Thanks!!!

John
Nov 12 '05 #1
5 1630
Hi John,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need some advice about how to write
module information to an XML file. If there is any misunderstanding, please
feel free to let me know.

I think you can put the SaveState() method in each module and make it
return an XmlElement. Each module returns his own state information. The
SaveState() method in the parent module gets the return values from child
modules and combine it to a larger XmlElement and return to the upper
level. At the top level, we can put the last XmlElement into an XmlDocument
and writes it to an .xml file.

HTH. If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #2
Kevin,

Thank you. I believe you understand my question.

From within each module how do I create an XmlElement? I see how to
create an element from a document, but when there is no document I
don't understand how to create the element.

Thank you!
John

v-****@online.microsoft.com (Kevin Yu [MSFT]) wrote in message news:<dQ**************@cpmsftngxa10.phx.gbl>...
Hi John,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need some advice about how to write
module information to an XML file. If there is any misunderstanding, please
feel free to let me know.

I think you can put the SaveState() method in each module and make it
return an XmlElement. Each module returns his own state information. The
SaveState() method in the parent module gets the return values from child
modules and combine it to a larger XmlElement and return to the upper
level. At the top level, we can put the last XmlElement into an XmlDocument
and writes it to an .xml file.

HTH. If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #3
Kevin,

Thank you for your reply.

One other thought: I'm trying to understand the pros and cons of using
the ISerializable interface so that I can have each module "save" its
state when GetObjectData() is called to serialize the object and then
restore its state on deserialization? Any thoughts or advice?

Thanks,
John

v-****@online.microsoft.com (Kevin Yu [MSFT]) wrote in message news:<dQ**************@cpmsftngxa10.phx.gbl>...
Hi John,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need some advice about how to write
module information to an XML file. If there is any misunderstanding, please
feel free to let me know.

I think you can put the SaveState() method in each module and make it
return an XmlElement. Each module returns his own state information. The
SaveState() method in the parent module gets the return values from child
modules and combine it to a larger XmlElement and return to the upper
level. At the top level, we can put the last XmlElement into an XmlDocument
and writes it to an .xml file.

HTH. If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #4
Hi John,

If you need to create an XmlElement within each module, you can first
create an XmlDocument and create the XmlElement from that document. At
last, just return that XmlElement to the upper level.

When doing serialization, the whole object is saved. If you need to save
all the members in that object using serialization, each of the members
have to be serializable. If they didn't implement the
Iserializabel.GetObjectData(), you have to implement it.

HTH

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #5
Hi John,

I'd like to know if this issue has been resolved yet. Is there anything
that I can help. I'm still monitoring on it. If you have any questions,
please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #6

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

Similar topics

1
by: chris yoker | last post by:
hiya, I succesfully return a "nodeList" thru the "xmlDoc.SelectNodes" method. This nodeList is taken from a repetitive, uniform xml doc. I can successfully append a child node at the correct...
1
by: George W. | last post by:
Okay, I'm a C#/XML newbie, and I've been wrestling with this for a while now, checked dotnet sites, articles, MSDN Library, etc. and haven't been able to determine why this is happening. I have...
4
by: Thiru | last post by:
Hi, Greetings to All. I have encountered a problem while working on DB2 Governer. I build my configuration file as below.(Just for practise) desc "Restrict the Unit of Work to be less then 1...
8
by: Don Wash | last post by:
Hi There! I'm using VB.NET to create a TreeView application and unfortunately I could not find "Key" property in Node items of the TreeView. We used to have "Key" property in TreeView node...
1
by: db2udbgirl | last post by:
Env : DB2 UDB 8.2 / AIX 5.3 When I try to use some DB2 Utilities against a partitioned table which is not defined on a particular node (Node 0 in this case) I'm getting this error. ...
2
by: yawnmoth | last post by:
When I visit the following webpage: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Test</title> </head> <body> <div id="demo">this is a test...</div>
0
by: seasonmmclane | last post by:
I am clueless... Here is my code: Private Sub genCodeDynamic(ByVal nIn As XmlNode, ByRef nOut As XmlNode, ByVal docOut As XmlDocument, _ ByVal stopAtNode As XmlNode, ByVal dr As DataRow) ...
7
by: dennis.sprengers | last post by:
I am trying to write an editor object, which adds some functionality and a toolbar to every textarea with a "form-textarea" class. Both FF and IE generate an error in line 20...
2
by: Tom Chang | last post by:
Try to read following type of XML file, but only get data back on first node: <log id="1234"> <message type="Action"/> </log> <log id="5678"> <message type="Drama"/> </log> <log id="1357">
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.