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

Converting an object into an XmlNode

Hi,

Is there a clean way to build up an XML Node from an
object?

What I am presently doing to create the node is:
1. Create a StringWriter and then use XmlSerializer to
serialize the object into that StringWriter.
2. Create a new XmlDocument called tempDoc and call
tempDoc.LoadXml(stringWriter.ToString())
3. Create an XmlNode by calling myDoc.ImportNode
(tempDoc.LastChild, true)

Then I call AppendChild() to add this new node into the
correct position in myDoc.

Is there a cleaner way to do this? For example, is there
an XmlNodeWriter or equivalent?

Thanks
Hari

Nov 12 '05 #1
3 3326
Hari Menon wrote:
Is there a cleaner way to do this? For example, is there
an XmlNodeWriter or equivalent?


Sure. Have you tried to google for "XmlNodeWriter"?
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel
Nov 12 '05 #2
I did do the search and had found that the XmlNodeWriter
is not a supported class from Microsoft. There's an impl
in gotdotnet.

There are also some other implementations floating around.

Does this mean that the only clean way of doing this is
to write my own impl (or copy over an existing one) of
XmlNodeWriter????

_
hari
-----Original Message-----
Hari Menon wrote:
Is there a cleaner way to do this? For example, is there an XmlNodeWriter or equivalent?


Sure. Have you tried to google for "XmlNodeWriter"?
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel
.

Nov 12 '05 #3
an*******@discussions.microsoft.com wrote:
I did do the search and had found that the XmlNodeWriter
is not a supported class from Microsoft. There's an impl
in gotdotnet.

There are also some other implementations floating around.

Does this mean that the only clean way of doing this is
to write my own impl (or copy over an existing one) of
XmlNodeWriter????


What's wrong with using XmlNodeWriter from gotdotnet? It's been
developed by Microsoft XML architect actually and proven to be stable
and robust.
--
Oleg Tkachenko
XML Insider
http://www.tkachenko.com/blog
Nov 12 '05 #4

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

Similar topics

5
by: Ian Williamson | last post by:
Greetings, I have seen this question posted a few times, but the answers have not helped me. I have used the program xsd.exe to generate several c# classes from a client provided xsd...
3
by: awong | last post by:
Hi there, I was trying to convert the following VB6 code to VB.NET. But I can't find a corresponding System.XML object for MSXML IXMLDOMSelection. I am thinking to use System.XML XMLNodeList...
3
by: Mahesh Devjibhai Dhola | last post by:
Hi All, I want to make a custom class in c#, which extends System.Xml.XmlNode class of BCL. Now in custom class, I have implement abstract methods of XmlNode class also. Now when I am trying to...
1
by: Svyatoslav | last post by:
Hi, I have a problem with XmlNodes and my stack. It looks something like this: //declarations XmlNode node, new_node; Stack MyStack = new Stack(); //code MyStack.Push(node);
0
by: Pierre | last post by:
Hi, I'm trying to select specific nodes from a XmlDocument filled with a serialized object and to insert these nodes into another XmlDocument. The object is well serialized (see below). From a...
3
by: Mae | last post by:
Dear All, I have a problem here, I'm using C# Webform calling a webservices. The webservices return me a XMLnode, using this XMLnode I want to convert it to dataset so I can bind to the...
1
by: Marc | last post by:
Hi! I'm working with a C# client that calls a php web service. I've created a wrapper to call the service using .NET wsdl tool (adding a web reference). The call to the server works fine, it...
3
by: Techno_Dex | last post by:
I'm wanting to create a Wrapper (or Extender depending on how you look at it) for a Serializable object that I then want to send over a webservice. Basically I want to create a Serializable Object,...
2
by: NightHawk | last post by:
I am using C# in VS2005 .Net, with a service which passes data to a proxy using a soap message. If all of the instance variables are strong typed, I have no problem, but I need to pass an instance...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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.