<?xml version="1.0" encoding="utf-8" ?>
<databases>
<database>
<database-name>pintar</database-name>
<username>root</username>
<password>password</password>
<host>202.152.yy.xx</host>
<backup-location>D:/DB/Mysql/</backup-location>
<mysql-folder>C:\xampp\mysql</mysql-folder>
</database>

<database>
<database-name>corporateagenda</database-name>
<username>root</username>
<password>password</password>
<host>202.152.xx.yy</host>
<backup-location>D:/DB/Mysql/</backup-location>
<mysql-folder>C:\xampp\mysql</mysql-folder>
</database>

</databases>

 


XDocument doc = XDocument.Load(AppDomain.CurrentDomain.BaseDirectory + "db.xml");
var q = from b in doc.Descendants("database")
select new
{

username = (string)b.Element("username"),
password = (string)b.Element("password"),
host = (string)b.Element("host"),
backuplocation = (string)b.Element("backup-location"),
oraclefolder = (string)b.Element("oracle-folder"),
sid = (string)b.Element("sid"),
};


foreach( var obj in q.ToList()){
Console.Write(obj.username);
Console.Write(obj.oraclefolder);
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: