private void xmlCekme()
{
System.Xml.XmlNode categoryNode = null;
System.Xml.XmlTextReader xmlRead = new System.Xml.XmlTextReader(@"e:/Deneme1.xml");
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
xmlDoc.Load(xmlRead); //Xml dökümanını dolduruyoruz
foreach (System.Xml.XmlNode node in xmlDoc.ChildNodes)
{
if (node.Name == "ILANLAR")
{
categoryNode = node;
foreach (System.Xml.XmlElement a in categoryNode)
{
switch (a.Name)
{
case "ILAN1":
TextBox1.Text = Convert.ToString(a.FirstChild.InnerXml);
TextBox2.Text = Convert.ToString(a.ChildNodes[1].InnerXml);
TextBox3.Text = Convert.ToString(a.ChildNodes[2].InnerXml);
TextBox4.Text = Convert.ToString(a.LastChild.InnerXml);
break;
case "ILAN2":
TextBox5.Text = Convert.ToString(a.FirstChild.InnerXml);
TextBox6.Text = Convert.ToString(a.ChildNodes[1].InnerXml);
TextBox7.Text = Convert.ToString(a.ChildNodes[2].InnerXml);
TextBox8.Text = Convert.ToString(a.LastChild.InnerXml);
break;
case "ILAN3":
TextBox9.Text = Convert.ToString(a.FirstChild.InnerXml);
TextBox10.Text = Convert.ToString(a.ChildNodes[1].InnerXml);
TextBox11.Text = Convert.ToString(a.ChildNodes[2].InnerXml);
TextBox12.Text = Convert.ToString(a.LastChild.InnerXml);
break;
case "ILAN4":
TextBox13.Text = Convert.ToString(a.FirstChild.InnerXml);
TextBox14.Text = Convert.ToString(a.ChildNodes[1].InnerXml);
TextBox15.Text = Convert.ToString(a.ChildNodes[2].InnerXml);
TextBox16.Text = Convert.ToString(a.LastChild.InnerXml);
break;
}
} xmlRead.Close();
}
}
}
Hiç yorum yok:
Yorum Gönder