473,385 Members | 1,908 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.

XML <-> object mapping tool?

Hi;

I have a small XML file that I need to read/change from my app. Is
there some easy way to map from XML to my objects so I can just read
it in to my objects, change the objects as needed, then write the
whole thing back out?

thanks - dave

david@at******@windward.dot.dot.net
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
Sep 25 '08 #1
2 4872
Hi Dave,

As for mapping object and xml document, the first thing I can get is the
XMLSerialization, which is the dedicated technique in .NET framework for
class /XML mapping. If the xml schema is not quite complex, you can
directly define the .net class(with XML serialization attributes) or use
the XSD.exe tool to generate the class code from xml file(or xsd schema):

#XML Serialization in .NET
http://www.codeproject.com/KB/XML/xmlserialize.aspx

#XML Serialization in the .NET Framework
http://msdn.microsoft.com/en-us/library/ms950721.aspx

#XML Schema Definition Tool (Xsd.exe)
http://msdn.microsoft.com/en-us/libr...0s(VS.71).aspx

also, with LINQ appearing, it is also very convenient to use LINQ2XML to
manipulate XML document, do some transforming(to different xml format or to
.NET class objects..) especially when you use VB.NET:

http://www.codeproject.com/KB/linq/LINQtoXML.aspx

http://blogs.msdn.com/xmlteam/archiv...to-xml-bridge-
classes-to-system-xml.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/...tance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: David Thielen <th*****@nospam.nospam>
Subject: XML <-object mapping tool?
Date: Wed, 24 Sep 2008 21:12:53 -0600
>Hi;

I have a small XML file that I need to read/change from my app. Is
there some easy way to map from XML to my objects so I can just read
it in to my objects, change the objects as needed, then write the
whole thing back out?

thanks - dave

david@at******@windward.dot.dot.net
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
Sep 25 '08 #2
Hi David,

If a tool then Liquid, Castor.net, and so on. take a look at http://www.thehtmltag.com/databinding.html
or http://www.byteslooser.com/csharp/xmlobjects/
Relatively easy way is de/serialization (with a combination of LINQ).

Regards, Alex Meleta
mailto:am*****@gmail.com; blog:devkids.blogspot.com
Hi;

I have a small XML file that I need to read/change from my app. Is
there some easy way to map from XML to my objects so I can just read
it in to my objects, change the objects as needed, then write the
whole thing back out?

thanks - dave

david@at******@windward.dot.dot.net
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com
Cubicle Wars - http://www.windwardreports.com/film.htm

Sep 25 '08 #3

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

Similar topics

5
by: Jonny T | last post by:
hi, i want to echo the string '<?php' in a php script like : echo "<?php"; but when i try nothing gets displayed ... if I use echo "<\?php";
7
by: haoren | last post by:
Can anybody help me with this problem: How can I echo a string that contain <? and <?php? For example, $str="test <? and <?php echo"; echo $str;
3
by: winderjj | last post by:
Hi All, I need everyones opinion. I am very new to XML but am temporarily putting all my efforts into using it. This is what I need to do. Write an xml parser (in C) that will parse a...
4
by: matatu | last post by:
Hi to all, I have a xml file, a substring like: &lt;a href=&quot;#&quot;&gt;text&lt;/a&gt; which after an xslt trasform is rendered as (using xsl:output method html): &lt;a...
4
by: higabe | last post by:
Three questions 1) I have a string function that works perfectly but according to W3C.org web site is syntactically flawed because it contains the characters </ in sequence. So how am I...
5
by: tobbe | last post by:
Hi Im trying to load a XmlDataDocument with the following xml: <ROOT> <NAME> &LT; &AMP; &GT; " '</NAME> </ROOT> And i know I have a entity problem here, but i cant find any solution for...
10
by: Jon Noring | last post by:
Out of curiosity, may a CDATA section appear within an attribute value with datatype CDATA? And if so, how about other attribute value datatypes which accept the XML markup characters? To me,...
4
by: Armel Asselin | last post by:
Hello, I've been using XML for a while in a rather 'free' manner (i.e. as long as IE accept it it's OK), I read recently (again) the Xml standard 1.0 (3rd edition) and found this sentence: ...
4
by: spibou | last post by:
I saw it at http://www.faqs.org/rfcs/rfc1305.html Is it not the same as writing ``if (m)'' ?
3
by: webmasterATflymagnetic.com | last post by:
Folks, I'm struggling to put the question together, but I have this problem. I have written an HTML form that I can use for data entry. This uses PHP to write a SQL UPDATE command that gets...
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: 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:
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...
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,...
0
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...

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.