-
<% @language="jscript"%>
-
<%
-
-
var fso=Server.CreateObject("scripting.filesystemobject")
-
fso.CreateTextFile(Server.Mappath("./")+"/test1.xml");
-
f = fso.GetFile(Server.Mappath("./")+"/test1.xml");
-
ts = f.OpenAsTextStream(2,-2);
-
ts.Write( "<root><name>"+escape("中国").replace(/%u(\w{4})/g,function($0,$1){return "&#"+(("0x"+$1)-0).toString(10)+";"})+"</name></root>" );
-
ts.Close();
-
-
%>
-
<%
-
-
var objStream = Server.CreateObject("ADODB.Stream")
-
with(objStream)
-
{
-
Type=2;
-
Mode=3;
-
Open();
-
Charset="utf-8";
-
Position = objStream.Size
-
WriteText="<root><name>"+escape("中国").replace(/%u(\w{4})/g,function($0,$1){return "&#"+(("0x"+$1)-0).toString(10)+";"})+"</name></root>";
-
SaveToFile(Server.mappath("test2.xml"),2)
-
Close()
-
}
-
var objStream = null;
-
%>
-
<%
-
<--
-
-
var doc = new ActiveXObject("Msxml2.DOMDocument");
-
-
-
-
-
var p = doc.createProcessingInstruction("xml","version='1.0' encoding='utf-8'");
-
-
doc.appendChild(p);
-
-
-
-
-
-
doc.createElement("root");
-
var root = doc.createNode(1,"root","");
-
-
var n = doc.createNode(1,"name","");
-
-
n.appendChild(doc.createTextNode(escape("中国").replace(/%u(\w{4})/g,function($0,$1){return "&#"+(("0x"+$1)-0).toString(10)+";"})));
-
-
root.appendChild(n);
-
-
-
var c = doc.createCDATASection("this is a cdata");
-
c.text = "hi,cdata";
-
-
root.appendChild(c);
-
-
doc.appendChild(root);
-
-
doc.save(Server.MapPath("./")+"/test3.xml");
-
-
-
%>