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

Practical use for XMLSerialization

I have just started reading up on XMLSerialization and still do not
understand the practical use of this technology.

For example, if I have to know the class type on the client and on the web
service side, wouldn't it be easier to just use .Net remoting?

I envision some point of passing over the XML document but the web service
not really knowing about the objects type.

Am I way off base with my perceptions?

STom
Nov 11 '05 #1
2 3429
Xml Serialization is a general purpose, object-to-XML mapping technology.
It is not used strictly for remoting between a .NET client and a .NET
server.

For example, support there is a third-party app (of unknown derivation) that
generates XML (of known schema). Xml Serialization in .NET allows you to
generate classes that map to the XML. I can then de-serialize from within
the .NET app, and get an in-memory object graph direct from the XML. No
DOM, very simple.

The opposite also applies. suppose an external app needs to consume XML
produced by a .NET app. The .NET app can emit the XML via serialization,
transmit it "any way it wants to", in a file, on a queue, via SMTP,
whatever. Then the external app can read and parse the XML as it sees fit.

SOAP and web services are specific applications of the above.

Another scenario - I have a bunch of apps I wrote that need to store config
info. Using XML serialization is a simple easy way to do it. I write the
type or types I want to use to store my config info (or metadata), then I
can serialize and de-ser as necessary. Simple.

I guess the basic idea is, Sometimes I want to get objects from XML. Other
times I want to get XML from my objects. Xml Serialization does that for
me.

-Dino
"STom" <st***********@hotmail.com> wrote in message
news:OO**************@TK2MSFTNGP11.phx.gbl...
I have just started reading up on XMLSerialization and still do not
understand the practical use of this technology.

For example, if I have to know the class type on the client and on the web
service side, wouldn't it be easier to just use .Net remoting?

I envision some point of passing over the XML document but the web service
not really knowing about the objects type.

Am I way off base with my perceptions?

STom

Nov 11 '05 #2
STom,

Xml Serialization, or Xml data binding, is a great way to make any kind of
rigidly structured Xml data available to an object-oriented application. As
Dino pointed out, there are many different scenarios when parsing or
creating Xml through serialization is useful. What these scenarios have in
common, is that you

* access a large portion of the document, i.e. going through XPath and DOM
would add considerable overhead,
* you do not have mixed content
* you don't require "positional" access to the Xml content
* you process many different node from the document so DOM-based access
would lead to cluttered, hard-to-read code.

It is most natural, when you build applications that exchange messages in a
somewhat object-oriented Xml format, such as those defined by Xml Schemas.
Using Xml serialization you can transform the data you transform into the
most suitable representation, objects within you application and Xml when
you transfer them.

In contrast to remoting (any remoting technology, not just .NET Remoting),
these messages do typically not represent method calls. They represent data,
possibly defined by a type in an Xml Schema, not just a .NET type. With
serialization, you do not require the same .NET type to map the the XML
type, i.e. two applications exchanging Xml messages can implement their own
classes as long as they map to the same Xml type. These types can even use
different binding technologies, such as XmlSerialization in .NET and Castor
in java.

Other examples of regidly structured Xml data are Xml-based protocols, such
as Soap or xmlCIM. It is much easier to precess those via XmlSerialization
since most likely need to access data from the entire message.

Dare Obasanjo had an article on XML.COM comparing the different Xml APIs [0]
that also fits into this context.
--
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor

[0] http://www.xml.com/pub/a/2003/07/09/xmlapis.html

"STom" <st***********@hotmail.com> wrote in message
news:OO**************@TK2MSFTNGP11.phx.gbl...
I have just started reading up on XMLSerialization and still do not
understand the practical use of this technology.

For example, if I have to know the class type on the client and on the web
service side, wouldn't it be easier to just use .Net remoting?

I envision some point of passing over the XML document but the web service
not really knowing about the objects type.

Am I way off base with my perceptions?

STom

Nov 11 '05 #3

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

Similar topics

0
by: Omkar Singh | last post by:
When I serialize my class using XmlSerialization.serialize, it make a lot of reference in the output document. Is there any way to off XmlSerialiation class to make references.
0
by: Omkar Singh | last post by:
I am using XmlSerialization and XmlDeserialization for making soap Body part. Then I am making sopa-header and other part of soap envelope manually. At last joining all part to get complete soap...
0
by: Omkar Singh | last post by:
I have a problem while using XmlSerialization. XmlSerializaion creates a lot of 'href' and namespaces while serializing a complex object. Can we control serialization to stop href and namespaces. ...
0
by: Ian | last post by:
I've got this problem with overriding attributes on an inheritance chain where the XmlSerializer is concerned. For example: public class A { private string aWord = String.Empty(); public...
0
by: A programmer desperatly needing help! | last post by:
I use the xmlserialization on asp.net pages and on previous machines it never gave a problem. But now i somethings get a: Timed out waiting for a program to execute. The command being executed was...
4
by: pfrisbie | last post by:
I am developing a Web Services interface with C# and our partner is using Java (Axis 1.1). They require me to include xsi:types in the SOAP Messages I send them. For example: <Partner...
3
by: LW | last post by:
Hi! I am getting the following error message for my fairly simple web service. I have classes and have two DataSets that reference the same classes. The error is: The XML element named...
1
by: Frank | last post by:
Hi, Let's say I have a file named myFile.xml Within that file I have blocks of data which I'd like to add at different times during the day. e.g. <LogEntry>
0
by: IanWright | last post by:
This is a little bit more of an advanced topic for serialization. For those who don't know what XML serialization is, then this probably isn't for you just yet. For those that do, you may have come...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
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...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.