用asp获取网页的代码,并将相应的代码转化为字符串形式

来源:百度知道 编辑:UC知道 时间:2024/05/29 15:35:46
因为只有将代码转化为字符串形式,才能使用
xml.loadXML(str)这个函数

Function ReadThemeHtml(ByVal FilePath)
Dim Fso
Set Fso = Server.CreateObject("Scripting.FileSystemObject")
If Not Fso.FileExists(Server.MapPath(FilePath)) Then
ReadThemeHtml = "模板文件不存在!"
Exit Function
End If

Dim openFile,strTemp
Set openFile=Fso.OpenTextfile(server.mapPath(FilePath)) 'true为不存在自行建立
strTemp = openFile.ReadAll
Set OpenFile = Nothing
Set Fso = Nothing
ReadThemeHtml = strTemp
End Function