468,761 Members | 1,779 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,761 developers. It's quick & easy.

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 3544
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Jeff T. | last post: by
1 post views Thread by Maheal | last post: by
3 posts views Thread by Amadelle | last post: by
3 posts views Thread by AnkitAsDeveloper [Ankit] | last post: by
reply views Thread by Goethals Frederik | last post: by
1 post views Thread by Rucha | last post: by
3 posts views Thread by Zachary Turner | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.