-
-
Save ebubekirbastama/6d17b9e5b4f6215da71b49a6a9274166 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Xml; | |
class Program | |
{ | |
static void Main() | |
{ | |
XmlDocument xmlDoc = new XmlDocument(); | |
XmlElement root = xmlDoc.CreateElement("Stok"); | |
xmlDoc.AppendChild(root); | |
// Ürünleri ekleyelim | |
XmlLinkedNode urun1 = xmlDoc.CreateElement("Urun"); | |
urun1.Attributes.Append(xmlDoc.CreateAttribute("ID")); | |
urun1.Attributes["ID"].Value = "001"; | |
urun1.Attributes.Append(xmlDoc.CreateAttribute("Adi")); | |
urun1.Attributes["Adi"].Value = "Laptop"; | |
urun1.InnerText = "20"; // Stok miktarı | |
root.AppendChild(urun1); | |
XmlLinkedNode urun2 = xmlDoc.CreateElement("Urun"); | |
urun2.Attributes.Append(xmlDoc.CreateAttribute("ID")); | |
urun2.Attributes["ID"].Value = "002"; | |
urun2.Attributes.Append(xmlDoc.CreateAttribute("Adi")); | |
urun2.Attributes["Adi"].Value = "Akıllı Telefon"; | |
urun2.InnerText = "35"; // Stok miktarı | |
root.AppendChild(urun2); | |
// XML'i yazdıralım | |
Console.WriteLine("Stok Yönetimi XML: " + xmlDoc.OuterXml); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment