There are a number of ways to get the data into XML, and Xml serialization would probably be the easiest way, assuming that when you read your data in from the text file, you're creating objects, and not just trying to go right from the string values to XML.
When I have to do something like this, I create an object to hold the data, and provide a
XElement
property that allows me to set/get the object data using a
XElement
object. This makes it easy to maintain, and keeps all the nigly xml stuff localized to a good degree. he secret to my method is this:
using System.Xml.Linq;
The
XDocument
,
XElement
, and
XAttribute
objects really make doing XML easy. I also wrote a tip/trick that describes some extension methods I came up with to make getting/setting values easier:
Using Extension Methods To Avoid XML Problems[
^]
EDIT ===============
You're right, .Net 2.0 doesn't have Linq. There should be a lot of XML helper classes available out there in the ether. Some judicious googling on your part would probably go a long way toward finding an answer. many times, google will expose applicable articles right here on CodeProject.