السلام عليكم ورحمة الله وبركاته
عندي ملف xml
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="dynamic.xslt"?>
<styles>
<project>
<pr_Id></pr_Id>
<style>
<header>
<height>inherit</height>
<background>
<color>inherit</color>
<image>inherit</image>
<repeat>inherit</repeat>
<position>inherit</position>
</background>
</header>
</style>
</project>
</styles>أريد عند انشاء مشروع يتم انشاء <project> وكل اللي بداخله فقمت بالتالي:
XmlDocument xmldocStyle = new XmlDocument();
xmldocStyle.Load(Server.MapPath("style/dynamic.xml"));
XmlElement proj = xmldocStyle.CreateElement("project");
XmlElement pr_Id = xmldocStyle.CreateElement("pr_Id");
XmlElement style = xmldocStyle.CreateElement("style");
//////header/////////
XmlElement header = xmldocStyle.CreateElement("header");
XmlElement heightHeader = xmldocStyle.CreateElement("height");
XmlElement backgroundHeader = xmldocStyle.CreateElement("background");
XmlElement colorHeader = xmldocStyle.CreateElement("color");
XmlElement imageHeader = xmldocStyle.CreateElement("image");
XmlElement repeatHeader = xmldocStyle.CreateElement("repeat");
XmlElement positionHeader = xmldocStyle.CreateElement("position");
pr_Id.InnerText = New_Id.ToString();
colorHeader.InnerText= "inherit";
imageHeader.InnerText = "inherit";
repeatHeader.InnerText = "inherit";
positionHeader.InnerText = "inherit";
sizeHeader.InnerText = "inherit";
familyHeader.InnerText = "inherit";
heightHeader.InnerText = "inherit";
backgroundHeader.AppendChild(colorHeader);
backgroundHeader.AppendChild(imageHeader);
backgroundHeader.AppendChild(repeatHeader);
backgroundHeader.AppendChild(positionHeader);
proj.AppendChild(pr_Id);
proj.AppendChild(style);
xmldocStyle.DocumentElement.AppendChild(proj);ماني عارفة أيش المشكله مو راضي يضيف في ملف xml