471,594 Members | 1,835 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,594 software developers and data experts.

Serializing object graph directly to XML document rather than to text

Is there a way to serialize a graph of objects and get the output as an XML
document, without first serializing to text and then parsing the text (I
know how to do this but I find it really silly and inefficient).

I googled around and from what I found, the answer is NO. Am I missing
something obvious? Is there something new coming in .NET 2.0?

Of course, I'm also interested in the reverse operation (deserializing
directly from XmlDocument rather than from text).

Bruno
Nov 12 '05 #1
3 1821


Bruno Jouhier wrote:
Is there a way to serialize a graph of objects and get the output as an XML
document, without first serializing to text and then parsing the text (I
know how to do this but I find it really silly and inefficient).


I am not sure what you mean with XML document here, if you serialize you
usually serialize to a stream or file and then you have an XML document
there in that file respectively the file is an XML document.
Or are you talking about System.Xml.XmlDocument and want to convert some
graph of objects into an instance of System.Xml.XmlDocument?
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 12 '05 #2

"Martin Honnen" <ma*******@yahoo.de> a écrit dans le message de news:
uT**************@TK2MSFTNGP14.phx.gbl...


Bruno Jouhier wrote:
Is there a way to serialize a graph of objects and get the output as an
XML document, without first serializing to text and then parsing the text
(I know how to do this but I find it really silly and inefficient).
I am not sure what you mean with XML document here, if you serialize you
usually serialize to a stream or file and then you have an XML document
there in that file respectively the file is an XML document.
Or are you talking about System.Xml.XmlDocument and want to convert some
graph of objects into an instance of System.Xml.XmlDocument?


Of course, I mean an instance of XmlDocument (or XmlElement).


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

Nov 12 '05 #3
More on this: I needed this because I have a web service with a WebMethod
that returns an XmlNode (this is a generic method that may return different
graphs for different types of objects, I have another method that returns
the associated schema so the client knows what he is dealing with).

I think that I have found my solution:
http://weblogs.asp.net/cazzu/archive...rformance.aspx

But still, it would be nice if there were a simple API to convert back and
forth between graphs of objects and XmlElement.

Bruno
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Steve Darby | last post: by
1 post views Thread by Ivo Bronsveld | last post: by
2 posts views Thread by Tobias Zimmergren | last post: by
1 post views Thread by Tjerk Wolterink | last post: by
22 posts views Thread by Cylix | last post: by
17 posts views Thread by Jef Driesen | last post: by
12 posts views Thread by Cagdas Ozgenc | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

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.