473,669 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4137
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...@yaho o.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.xmle lement.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.xmld ocument.readnod e.aspx>
to pass in an XmlReader and create a node. Or you can create an
XmlDocumentFrag ment 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
2081
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 NodeValue; ListStruct *NextNode; }
6
3614
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 regarding project folder structure: "Directory names should follow the namespace for the class For example, I would expect to find the public class "System.Windows.Forms.Control" in "System\Windows\Forms\Control.cs"."
12
2553
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
14470
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 me do this saying that I can't declare a structure with fixed size arrays. Yet the book I'm looking at shows
6
1183
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 Dim var1 As String Dim var2 As Integer Dim var3 As Boolean End Structure
11
2819
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 playing with <StructLayoutArribute()and <MarshalAs()attributes, but I'm not really wanting to expose these structrues to COM. I only want to use
4
1288
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 where level is a structure:
5
4467
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 Another assembly, sharing the root namespace, contains a set of Custom attributes used to validate properties values, just like the Validation Application Block.
4
1717
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 uiform As Form1, ByRef si As MTCC02.Form1.SiteRunOpts, _ ByVal numitems As Integer) #End Region
5
1552
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 the identical structure and properties. the only difference between them is there methods and that one is a collection class and the other is not. currently the code starts like this:
0
8465
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
8383
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8588
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
8658
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...
1
6210
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4386
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.