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

Serialization

Experienced members,

I need some advice, or maybe I am missing something
simple.

I have 2 classes.

public class Manager

public property Controls as arraylist

public function CreateObject(byval type as Types) as
IObject

end class

public class myControl
implement IObject
public property Controls as arraylist
public property Parent as IObject
end class

I have a circular reference when I do this;

dim man as new manager
dim c1 as new myControl
dim c2 as new myControl

c1.controls.add(c2)
c2.Parent = c1
man.controls.add(c1)

Ok, now I have a object tree. I would like to serialize
the manager object in a human readable format. I have
used the soapformmater (ugly xml and don't need in soap
fromat) as well as the binaryformatter (works, but not
human readable).

My question is.... Is there a way to serialize this in
much the same way that the xmlserializer would? Or, is
there a design pattern different to hold a reference to
child and parent?

I would be very greatful for any direction on this.

Thanks in advance,

Chris Smith
Nov 12 '05 #1
2 2464
Chris,

you can instruct the XmlSerializer to produce Soap 1.1 section 5 compliant
XML much like the SoapFormatter does. This should be sufficient if you're
just after a human readable, XML based format. Take a look at the thread of
[0] for more details on how to get section 5 formatted XML out of the
XmlSerializer.

--
HTH
Christoph Schittko [MVP, XmlInsider]
Software Architect, .NET Mentor

[0]
http://groups.google.com/groups?hl=e...TNGP11.phx.gbl

"Chris Smith" <us**@email.com> wrote in message
news:#N**************@TK2MSFTNGP09.phx.gbl...
Experienced members,

I need some advice, or maybe I am missing something
simple.

I have 2 classes.

public class Manager

public property Controls as arraylist

public function CreateObject(byval type as Types) as
IObject

end class

public class myControl
implement IObject
public property Controls as arraylist
public property Parent as IObject
end class

I have a circular reference when I do this;

dim man as new manager
dim c1 as new myControl
dim c2 as new myControl

c1.controls.add(c2)
c2.Parent = c1
man.controls.add(c1)

Ok, now I have a object tree. I would like to serialize
the manager object in a human readable format. I have
used the soapformmater (ugly xml and don't need in soap
fromat) as well as the binaryformatter (works, but not
human readable).

My question is.... Is there a way to serialize this in
much the same way that the xmlserializer would? Or, is
there a design pattern different to hold a reference to
child and parent?

I would be very greatful for any direction on this.

Thanks in advance,

Chris Smith

Nov 12 '05 #2
Chris,

In addition to the other advice provided by Cristoph Schittko, I may also suggest you that instead of trying to "clear up" the "ugly" XML resulted through XML SOAP formatting, you can try to write a XSLT translator which translates the "ugly" XML to a simpler and more readable XML format or to HTML.

XSLT is very powerful and provides support for X/Path query expressions which could get your job done very quickly, I suppose.

--
Sorin Dolha [MCP, MCAD]
"Chris Smith" <us**@email.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl...
Experienced members,

I need some advice, or maybe I am missing something
simple.

I have 2 classes.

public class Manager

public property Controls as arraylist

public function CreateObject(byval type as Types) as
IObject

end class

public class myControl
implement IObject
public property Controls as arraylist
public property Parent as IObject
end class

I have a circular reference when I do this;

dim man as new manager
dim c1 as new myControl
dim c2 as new myControl

c1.controls.add(c2)
c2.Parent = c1
man.controls.add(c1)

Ok, now I have a object tree. I would like to serialize
the manager object in a human readable format. I have
used the soapformmater (ugly xml and don't need in soap
fromat) as well as the binaryformatter (works, but not
human readable).

My question is.... Is there a way to serialize this in
much the same way that the xmlserializer would? Or, is
there a design pattern different to hold a reference to
child and parent?

I would be very greatful for any direction on this.

Thanks in advance,

Chris Smith
Nov 12 '05 #3

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

Similar topics

3
by: Aaron Clamage | last post by:
Hi, I'm not sure that if this is the right forum, but any help would be greatly appreciated. I am porting some java serialization code to c# and I can't figure out the correct way to do it. ...
4
by: mijalko | last post by:
Hi, I have inherited my class from System.Drawing.Printing.PrintDocument and I wish to serialize this object using XmlSerializer. And I get exception "There was an error reflecting type ...". If I...
0
by: bharathreddy | last post by:
Before going to that i want to say few thing on serialization : Serialization is the process of converting an object into a form that can be readily transported. For example, you can serialize an...
1
by: kikisan | last post by:
I am developing a windows service which utilizes the following classes: interface IPersistable; abstract class PersistableObject : IPersistable;
2
by: mkvenkit.vc | last post by:
Hello, I hope this is the right place to post a question on Boost. If not, please let me know where I can post this message and I will do so. I am having a strange problem with std::string as...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.