السلام عليكم ورحمه الله وبركاته
كيف اضيف عنصر جديد فى ملف XML من صفحه ال html ؟
هناك مشكله انه يضيف العنصر فعلا ولكن لا يقوم يتخزينه فى الملف والمثال مأخوذ من هذا الموقع وليس به اخطاء ان شاء الله
http://www.w3schools.com/dom/tryit.asp?filename=try_dom_createelement1
ملف ال XML
<?xml version="1.0" ?> <bookstore> <book category="cooking"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> </bookstore>
صفحه ال HTML
<html>
<head>
<script type="text/javascript" src="loadxmldoc.js">
</script>
</head>
<body>
<script type="text/javascript">
xmlDoc=loadXMLDoc("books.xml");
newel=xmlDoc.createElement("edition");
newtext=xmlDoc.createTextNode("first");
newel.appendChild(newtext);
x=xmlDoc.getElementsByTagName("book")[0];
x.appendChild(newel);
//Output title and edition
document.write(x.getElementsByTagName("title")[0].childNodes[0].nodeValue);
document.write(x.getElementsByTagName("edition")[0].childNodes[0].nodeValue);
</script>
</body>
</html>ارجو المساعده
وشكرا مقدما ..

