473,546 Members | 2,205 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.do t.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 4888
Hi Dave,

As for mapping object and xml document, the first thing I can get is the
XMLSerializatio n, 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****@microsof t.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.d ot.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.bl ogspot.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.do t.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
2371
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
5157
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
1963
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 fairly complicated XML file that is full of technical data(most scalar values). Then I need to store all the info in a C structure. Could some people...
4
9631
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 href="#"&gt;text&lt;/a&gt;
4
62090
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 supposed to write this function? String.replace(/</g,'&lt;');
5
3527
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 it. The problem is that i recive this from external source and cant
10
42940
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, the XML specification seems a little ambiguous on this, so I defer to the XML authorities. Refer to sections 2.4 and 2.7 (it all hinges on if CDATA...
4
1905
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: Well-formedness constraint: No < in Attribute Values The replacement text of any entity referred to directly or indirectly in an attribute value MUST...
4
1797
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
3990
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 written to my MySQL database. I can later view this data back in the form. One thing I've noticed happening is if I enter code such as &lt; it gets...
0
7507
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...
0
7435
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...
0
7947
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7461
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...
0
6030
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5361
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...
0
3492
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...
0
3472
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.