function createNode4This(Obj) {

var doc = new ActiveXObject("Msxml2.DOMDocument"); doc.load(path); var newCus=doc.createElement("Customer");
var name=doc.createElement("name");
name.appendChild(doc.createTextNode(Obj["name"]));
var pwd=doc.createElement("pwd");
pwd.appendChild(doc.createTextNode(Obj["pwd"]));
var sex=doc.createElement("sex");
sex.appendChild(doc.createTextNode(Obj["sex"]));
var height=doc.createElement("height");
height.appendChild(doc.createTextNode(Obj["height"]));
var weight=doc.createElement("weight");
weight.appendChild(doc.createTextNode(Obj["weight"]));
var birthday=doc.createElement("birthday");
birthday.appendChild(doc.createTextNode(Obj["birthday"]));
var telephone=doc.createElement("telephone");
telephone.appendChild(doc.createTextNode(Obj["telephone"]));
var email=doc.createElement("email");
email.appendChild(doc.createTextNode(Obj["email"]));
var address=doc.createElement("address");
address.appendChild(doc.createTextNode(Obj["address"]));
var company=doc.createElement("company");
company.appendChild(doc.createTextNode(Obj["company"]));
var comments=doc.createElement("comments");
comments.appendChild(doc.createTextNode(Obj["comments"])); var a = doc.getElementsByTagName("Customers");

var newCusNode = a[a.length - 1].appendChild(newCus);
newCusNode.appendChild(name);
newCusNode.appendChild(pwd);
newCusNode.appendChild(sex);
newCusNode.appendChild(height);
newCusNode.appendChild(weight);
newCusNode.appendChild(birthday);
newCusNode.appendChild(telephone);
newCusNode.appendChild(email);
newCusNode.appendChild(address);
newCusNode.appendChild(company);
newCusNode.appendChild(comments);

var fso = new ActiveXObject("Scripting.FileSystemObject");
var f = fso.GetFile(path);
ts = f.OpenAsTextStream(2);
ts.Write(doc.xml);
ts.Close( );上面是我写的一个增加结点的方法,执行后结点是保存下来了,但是XML文件的头里的encoding没有了,导致增加结点后的XML文件无法读取.哪位大大有好办法的,3Q3Q