xml乱码
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<%
'response.charset="utf-8"
dim o
set o=new clsXML
o.LoadFile("xml.htm")
Response.Write("<pre>" & server.htmlencode(o.XML) & "</pre>")
'o.SaveFile("xml2.htm")
dim n
'set n=o.GetNode("/Resource/Item[@name='resname2']")
dim nn,ln
set ln=o.Create("Item")
ln.appendchild(o.Create("Description"))
ln.appendchild(o.Create("Data"))
ln.childNodes(0).text="新建元素"
ln.childNodes(1).text="新建数据"
Response.Write("<pre>" & server.htmlencode(ln.XML) & "</pre>")
_______________________
Public Function LoadFile(sfile)
domXML.load(server.MapPath(sFile))
set oRootNode=domXML.documentElement
End Function
______________________
XML文件也是utf8的编码
<?xml version="1.0" encoding="utf-8" ?>
<Resource xmlns:b="http://www.blue1018.net/resource">
<Item name="resname" >
<Description>
资源描述
</Description>
<Data>
数据。。。。。。。。。。。
</Data>
</Item>
<Item name="resname2">
<Description>
资源描述2
</Description>
<Data>
数据2。。。。。。。。。。。
</Data>
</Item>
</Resource>
——————————————————————————————
问题是,从文件中读取的xml的输出结果是乱码,而新建节点的输出结果正常