PDA

View Full Version : ساخت فایل xml



elena2007
یک شنبه 08 اردیبهشت 1398, 14:38 عصر
سلام. من نیاز دارم یه فایل xml با این فرمت بسازم :
<?xml version="1.0" encoding="UTF-8"?>
<CutList order="304.Obj" NParts="2" NBoards="1">
<Part id='P1' L='200' W='100' qMin='1' Grain='1' Code='1' MatNo='3' SizeNo='1'/>

</CutList>




ممنون میشم راهنمایی کنید

elena2007
یک شنبه 08 اردیبهشت 1398, 15:03 عصر
پیدا کردم .
XmlDocument doc = new XmlDocument();
XmlElement root = doc.CreateElement("Country");
XmlElement id = doc.CreateElement("Emp");
id.SetAttribute("Name", "A");
id.SetAttribute("Address", "Add1");
root.AppendChild(id);
doc.AppendChild(root);

doc.Save(Server.MapPath("BookStore.xml"));