472,958 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 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 3786
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...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.