473,387 Members | 1,575 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,387 software developers and data experts.

structure of xml classes in C#

Hi

I need to exchange XML formated information between two methods in my
C# program. I have been trying to play with XMLNode and XMLElement but
without much success. I think I want to stop now and understand the
xml classes in C# (rather in dot net) before proceeding further.

Can any one point me to such a resource ? Or even a primer on XML,
which explains the definitions of nodes, elements and attributes ?

Thanks.

May 1 '07 #1
4 4117
a.*******@gmail.com wrote:
I need to exchange XML formated information between two methods in my
C# program. I have been trying to play with XMLNode and XMLElement but
without much success. I think I want to stop now and understand the
xml classes in C# (rather in dot net) before proceeding further.

Can any one point me to such a resource ?
There is a huge section on MSDN that covers XML in the .NET framework:
<http://msdn2.microsoft.com/en-us/library/2bcctyt8(VS.80).aspx>
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
May 1 '07 #2
On May 1, 4:23 am, Martin Honnen <mahotr...@yahoo.dewrote:
Can any one point me to such a resource ?

There is a huge section on MSDN that covers XML in the .NET framework:
<http://msdn2.microsoft.com/en-us/library/2bcctyt8(VS.80).aspx>
Thanks for the pointer. However, I had read some of the articles
before and I still have the question that I had earlier. Let me try to
explain that and hopefully someone will know the answer to that.

I want to be able to exchange XML formated pieces of information
between two computers. I am not talking of exchanging just .NET
objects (for that purpose I can just use serialization / de-
serrialization). I want to be able to exchange information in XML
formated chunks. What XML related class can I instantiate to store my
information?

Thanks.
May 1 '07 #3
Thanks for the pointer. However, I had read some of the articles
before and I still have the question that I had earlier. Let me try to
explain that and hopefully someone will know the answer to that.

I want to be able to exchange XML formated pieces of information
between two computers. I am not talking of exchanging just .NET
objects (for that purpose I can just use serialization / de-
serrialization). I want to be able to exchange information in XML
formated chunks. What XML related class can I instantiate to store my
information?

Replying to my own email. However, after researching this some more, I
am getting the feeling that maybe I am approaching the problem
somewhat incorrectly. I think I have to create an XMLDocument first
and then add XMLElements to it.

1. Is this the right approach?
2. If so, how do I send just one element out of many over the wire?
Should I duplicate that element in a new XmlDocument (the new
XmlDocument having just one element?)?

Thanks.

May 1 '07 #4
C Sharp wrote:
I think I have to create an XMLDocument first
and then add XMLElements to it.

1. Is this the right approach?
2. If so, how do I send just one element out of many over the wire?
Should I duplicate that element in a new XmlDocument (the new
XmlDocument having just one element?)?
First of all, if you want to create XML to send it for instance over
HTTP then there is no need to use XmlDocument, it suffices to create the
XML on the fly with an XmlWriter, for instance created over the request
stream of an HttpWebRequest.
If you want to use XmlDocument, the DOM implementation in the .NET
framework, then yes, you always need an XmlDocument instance to use its
factory methods like CreateElement to create other node types (like
element nodes). There is no absolute need however to insert a created
element node into an XmlDocument, if you want to you can serialize a
single (non-document) node like an XmlElement, using the OuterXml
property for instance or of course using the WriteTo method
<http://msdn2.microsoft.com/en-us/library/system.xml.xmlelement.writeto.aspx>
again for instance to an XmlWriter created over the request stream of an
HttpWebRequest.
On the receiving end, if you also want to use the DOM there, you need to
create an XmlDocument and then you have various choices to convert the
stream of markup you receive into nodes, you can use the Load method of
the XmlDocument, you can use the ReadNode method
<http://msdn2.microsoft.com/en-us/library/system.xml.xmldocument.readnode.aspx>
to pass in an XmlReader and create a node. Or you can create an
XmlDocumentFragment and set its InnerXml.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
May 2 '07 #5

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

Similar topics

1
by: Victor Hannak | last post by:
I have two classes derived from a base class. The two derived classes each utilize a structure that is slightly different from one another. i.e. DerivedClass1: struct NodeStruct { float...
6
by: Vagif Abilov | last post by:
We decided to adopt .NET coding guidelines posted by Brad Abrams from Microsoft: http://blogs.msdn.com/brada/archive/2005/01/26/361369.aspx Here is what Brad (and AFAIK Microsoft) suggests...
12
by: imme929 | last post by:
How do I do it? Nothing in the books is helpful. I need to save a structure with different data types.
8
by: John Dann | last post by:
Trying to declare a structure that will contain a couple of fixed-size arrays. I'm trying eg: Structure IndexRecord Dim testarray(16) as Byte etc End Structure But vb.net is refusing to let...
6
by: zacks | last post by:
I recently wrote a VB.NET application using VS2005. I needed to be able to build linked lists in memory of items that were represented by a group of variables. For example, Friend Structure foo...
11
by: JerryWEC | last post by:
I want to be able to create a structure like I did in VB6, that have variables Name As String * 10 Age As String * 3 for the size of the strings. Can I do this some way in VB.net? I'm...
4
by: shapper | last post by:
Hello, I have a class which I am using in my profile. I made this class Serializable by using: <Serializable()_ Public Class Options One of the properties in this class is of type Level...
5
by: Sergio Montero | last post by:
I have a MustInherits Base class that implements a custom IDataLayer interfase. IDataLayer expose CRUD methods. Base class constructor requires two parameters: ConnectionString TableName ...
4
by: eBob.com | last post by:
In my class which contains the code for my worker thread I have ... Public MustInherit Class Base_Miner #Region " Delegates for accessing main UI form " Delegate Sub DelegAddProgressBar(ByVal...
5
by: jc | last post by:
RE: Two Classes with the same Data Structure.. saving code? Inheriting a structure? I have two classes. One in Inherits System.Collections.CollectionBase, the other does not, but they both have...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...

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.