Hi Ali,
Create an object representation of the xml file and fill it with data:
object NameValue
{
string Name;
string Value;
}
object Settings
{
string ReportName;
string ReportPath;
string ServerPath;
NameValue Pairs;
}
Settings settingsObject=new Settings();
settingsObject.ReportName="My report";
settingsObject.ReportPath="c:\\...";
settingsObject.ServerName="http://server...";
Then use XmlSerializer in the System.Xml.Serialization namespace and
serialize the object to disk:
FileStream fs=File.Create("mysettings.xml");
try
{
XmlSerializer serializer=new XmlSerializer(typeof(Settings));
serializer.Serialize(fs,settingsObject);
}
finally
{
fs.Close();
}
There you go
/Hugo
On Thu, 18 Nov 2004 16:39:15 -0800, ALI-R wrote:
I have tree variable with their values:
1) rptName="report1"
2) rptPath="c:\......"
3) serverPath=http://server...
and
4)an arry which contain Name/value pairs.
what is the best way of wrting them into an xml file??
these Xml files are stored in the same directory so I also give the XML file
a uniqe name so I can make sure that it dosn't overrite the other file.
thanks for your help.
ALI