473,320 Members | 2,006 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,320 software developers and data experts.

Xml serialization/deserialization

Suppose I have a RootObject which holds a collection of other objects.
The other objects have a property (Parent) which refers back to the "parent"
collection (b.t.w. my collection is based on CollectionBase), in similar
fashion as the object models of MS Office.

I want to serialize this object graph (with RootObject as the xml document
element) without Parent property serialized, this may be done by adding
XmlIgnoreAttribute on the Parent property (or if it should be a public
field).

Anyone knows a way to instruct the XmlSerializer to maintain the Parent
property during deserialization, or some other useful techniques ?

Nov 12 '05 #1
2 3808
You can get the XmlSerializer to produce an XML format that follows the
serialization guidelines of the SOAP 1.0/1.1 Section 5 standard [0].
It's not a very readable format but it maintains object references
during serialization.

See [1] or [2] for some examples.

HTH,
Christoph Schittko
MS MVP XML
http://weblogs.asp.net/cschittko

[0] http://www.w3.org/TR/2000/NOTE-SOAP-...#_Toc478383512
[1] http://www.dotnet247.com/247referenc...33/169909.aspx
[2]
http://msdn.microsoft.com/library/en...stemxmlseriali
zationxmlserializerclassctortopic3.asp?frame=true
-----Original Message-----
From: Snowman [mailto:ma**********@bluezone.no]
Posted At: Wednesday, September 22, 2004 8:09 AM
Posted To: microsoft.public.dotnet.xml
Conversation: Xml serialization/deserialization
Subject: Xml serialization/deserialization

Suppose I have a RootObject which holds a collection of other objects.
The other objects have a property (Parent) which refers back to the
"parent"
collection (b.t.w. my collection is based on CollectionBase), in similar fashion as the object models of MS Office.

I want to serialize this object graph (with RootObject as the xml document element) without Parent property serialized, this may be done by adding XmlIgnoreAttribute on the Parent property (or if it should be a public
field).

Anyone knows a way to instruct the XmlSerializer to maintain the Parent property during deserialization, or some other useful techniques ?

Nov 12 '05 #2
Re: Xml serialization/deserializationThanks for your reply
I was also thinking about using SOAP, however I am not serializing/deserializing to/from file or to/from systems understanding SOAP, but to/from an application (out of my control) which only understands "simple XML" according to a defined schema (xsd).
It is only the deserialization (when receiving from the foreign application) which creates a problem.
Of course I can write a taylor made deserializer, but not if this can be solved with existing functionality.

"Christoph Schittko [MVP]" <IN**********@austin.rr.com> wrote in message news:Oy**************@TK2MSFTNGP15.phx.gbl...
You can get the XmlSerializer to produce an XML format that follows the serialization guidelines of the SOAP 1.0/1.1 Section 5 standard [0]. It's not a very readable format but it maintains object references during serialization.
See [1] or [2] for some examples.
HTH,
Christoph Schittko
MS MVP XML
http://weblogs.asp.net/cschittko
[0] http://www.w3.org/TR/2000/NOTE-SOAP-...#_Toc478383512
[1] http://www.dotnet247.com/247referenc...33/169909.aspx
[2] http://msdn.microsoft.com/library/en...asp?frame=true
-----Original Message-----
From: Snowman [mailto:ma**********@bluezone.no]
Posted At: Wednesday, September 22, 2004 8:09 AM
Posted To: microsoft.public.dotnet.xml
Conversation: Xml serialization/deserialization
Subject: Xml serialization/deserialization

Suppose I have a RootObject which holds a collection of other objects.
The other objects have a property (Parent) which refers back to the
"parent"
collection (b.t.w. my collection is based on CollectionBase), in similar
fashion as the object models of MS Office.

I want to serialize this object graph (with RootObject as the xml document
element) without Parent property serialized, this may be done by adding
XmlIgnoreAttribute on the Parent property (or if it should be a public
field).

Anyone knows a way to instruct the XmlSerializer to maintain the Parent
property during deserialization, or some other useful techniques ?

Nov 12 '05 #3

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

Similar topics

4
by: Jeff T. | last post by:
Hello, I have an existing set of C# classes that encapsulate our application data. They are in a heirachy with each subclass defining more specific types of data. I would like to serialize these...
1
by: Maheal | last post by:
I have been trying to Serialize an object that is the child of another object which is also serializable. Here is the simplified scenario (assume missing code is correct): class One :...
3
by: Amadelle | last post by:
Hi all and thanks in advance for your help, I am having problems deserializing an object which seems to be serializing just fine. I save the byte array of the serialized object in the database...
3
by: AnkitAsDeveloper [Ankit] | last post by:
Hi i am serializing a 'ref struct' object as follows : private: void Seri( String ^path, Object^ obj ) { FileStream^ fileStrm ; try { //Serialize entire object into Binary stream
0
by: Goethals Frederik | last post by:
Hi, I have some questions that are a little difficult to explain, so I give it a try... I have an application (aSP.NET with VB.NET codebehind) and I would like to store my data on disk...
8
by: ashoksrini | last post by:
Hi All, I have the below requirement and would like to get some feeback from the group on the best way to implement: 1. I have WSDL defined exposing few web services. 2. We dont have a...
1
by: Rucha | last post by:
We are using ACAServices in our project, and are passing entity classes as parameters to the ACAServiceMethod. We are using a private variable entityState to indicate whether the entity is...
5
by: Harold Howe | last post by:
I am having a problem deserializing objects from a library when the following conditions exist: 1- The library is strongly named 2- The serialized file was created with version 1.0 of the...
3
by: Zachary Turner | last post by:
Hello, I have a situation where I would like to perform custom serialization and deserialization of an existing .NET framework object (specifically, System.DateTime). Is there a common paradigm...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.