473,804 Members | 2,252 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1893


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.XmlD ocument and want to convert some
graph of objects into an instance of System.Xml.XmlD ocument?
--

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

"Martin Honnen" <ma*******@yaho o.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.XmlD ocument and want to convert some
graph of objects into an instance of System.Xml.XmlD ocument?


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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1656
by: Steve Darby | last post by:
Hi all! I wonder if anyone can help with a problem I am having with a sctipt I have written. It uses the information stored in a cookie to generate a bar graph of sales for a range of cooking pans. I have managed to read the cookie information and draw the graph. The cookie is split and the values places into two arrays. The cookie however, stores information on the preferences for a text resizing facility in addition to the pan...
1
2174
by: mattoc | last post by:
Happy new year to all. I have a strange error that I've been trying for a while now to fathom.. Basically I have a hierarchy of state classes that I need to serialize to XML. Some of them can contain Exceptions, so I've decided to implement IXmlSerializable to get round the fact that Exception is not serializable.
1
2089
by: Ivo Bronsveld | last post by:
All, I have quite a challenging task ahead of me. I need to write an object model (for code access) based on a schema, which cannot be made into a dataset because of it's complexity. So I created a couple of objects and serializing it into XML based upon the schema works perfectly. The XML / Schema looks something like this:
2
3526
by: Tobias Zimmergren | last post by:
Hi, just wondering what serializing really is, and howto use it? Thanks. Tobias __________________________________________________________________ Tobias ICQ#: 55986339 Current ICQ status: + More ways to contact me __________________________________________________________________
1
1441
by: Tjerk Wolterink | last post by:
I have created an W3C XML DOM in java, it uses namespaces. Now i want to serialize it to the outputstream: === Document document=retrievePageDocument(page, manager.getDataStore()); response.setContentType("text/xml"); PrintWriter out=response.getWriter();
22
4199
by: Cylix | last post by:
I have a 4row x 1col table, I would like to drop all the content of row three. Since Mac IE5.2 does not suppport deleteRow method, I have also try to set the innerHTML=''; but it does not work. How can I delete the node from DOM in other way? Thanks.
17
2238
by: Jef Driesen | last post by:
Suppose I have a datastructure (actually it's a graph) with one template parameter (the property P for each edge and vertex): struct graph<P>; struct vertex<P>; struct edge<P>; I also have an algorithm that modifies this datastructure. The basic outline of the algorithm is independent of the type of property. So I implemented a generic version of the algorithm and a function object for
3
1677
by: Leeh | last post by:
I'm new to the world of RDF and RDF/XML so pardon my naive question: I understand that the "real" RDF model is the conceptual network of nodes (Subjects and Objects) connected by predicate arcs; and that the official way to serialize the graph is to use the RDF/XML specification. So far so good; but N3 and/or N-Triple notations are also used, and it sure seems to me that N3 is "iso-morphic" to the graph; i.e. The triples (properly...
12
4925
by: Cagdas Ozgenc | last post by:
Greetings, When directly serializing C++ structures to a file with the standard library functions giving the address of the data and length of structure using the sizeof operator, do I risk portability because of different compilers packing structures into different sizes or components of this structure to different address boundaries (for example placing in multiples of 4 on a 32bit system)? Once the file is serialized, does the same...
0
9714
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10599
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10346
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10347
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10090
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6863
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3832
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.