Xml
Here is a way to read an XML document, using the XmlTextReader function, which reads one row at a time for each read ().
Using System.Xml;
Public Ksbmconfig Readconfig (string xmlconfigfile)
{
Ksbmconfig _conf = new Ksbmconfig ();
Try
{
Open an XML file
System.Xml.XmlTextReader reader;
reader = new System.Xml.XmlTextReader (xmlconfigfile);
while (reader. Read ())
{
if (reader. NodeType = = xmlnodetype.endelement)
&& Reader. Name = = "KSBM"))
{
Break
}
if (reader. Isstartelement ("Serverpath"))
{
Reader. Read ();
_conf. Serverpath = reader. Value;
}
else if (reader. Isstartelement ("SmtpServer"))
{
Reader. Read ();
_conf. SmtpServer = reader. Value;
}
else if (reader. Isstartelement ("ConnectString"))
{
Reader. Read ();
_conf. ConnectString = reader. Value;
}
}
return _conf;
}
Catch
{
_conf. ConnectString = "";
_conf. Serverpath = "";
_conf. SmtpServer = "";
return _conf;
}
Finally
{
}
}