<%@ Language="Javascript" %>
<%
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
var root=xmlDoc.createElement("information");
xmlDoc.appendChild(root);
var iFrag=xmlDoc.createDocumentFragment();
for(var i=1;i<=Request.Form.Count;i++)
{
if(Request.Form.Key(i)!="sub")
{
for(var j=1;j<=Request.Form(i).Count;j++)
{
var field=xmlDoc.createElement("field");
var attID=xmlDoc.createAttribute("ID");
attID.text=Request.Form.Key(i);
field.setAttributeNode(attID);
var value=xmlDoc.createElement("value");
value.text=Request.Form(i)(j);
field.appendChild(value);
iFrag.appendChild(field);
}
}
}
root.appendChild(iFrag);
var p=xmlDoc.createProcessingInstruction("xml","version='1.0' encoding='gb2312'");
xmlDoc.insertBefore(p,root);
xmlDoc.save(Server.Mappath("information.xml"));
Response.Write("saved information.xml successfully!");
%>
posted on 2007-10-06 15:55
汪杰 阅读(301)
评论(0) 编辑 收藏 引用 所属分类:
xml