加入收藏 | 设为首页 | 会员中心 | 我要投稿 汽车网 (https://www.0577qiche.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

把ASP源代码转换成XML的工具有了

发布时间:2023-11-23 10:17:47 所属栏目:Asp教程 来源:
导读:下边这个存为Pack.asp,打包文件时运行
复制代码 代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%OptionExplicit%>
<%OnErrorResumeNext%>
<% Response.Charset="UTF-8"%>
<% Server.ScriptTimeou
下边这个存为Pack.asp,打包文件时运行
复制代码 代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> 
<%OptionExplicit%> 
<%OnErrorResumeNext%> 
<% Response.Charset="UTF-8"%> 
<% Server.ScriptTimeout=99999999%> 
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<htmlxmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<metahttp-equiv="Content-Type"content="text/html; charset=utf-8"/> 
<title>文件打包程序</title> 
</head> 

<body> 
<% 

Dim ZipPathDir, ZipPathFile 
Dim startime, endtime 
'在此更改要打包文件夹的路径 
ZipPathDir ="F:/www.yongfa365.com"' 
ZipPathFile ="update.xml" 
If Right(ZipPathDir,1)<>"/"Then ZipPathDir = ZipPathDir&"/" 
'开始打包 
CreateXml(ZipPathFile) 
'遍历目录内的所有文件以及文件夹 

Sub LoadData(DirPath) 
Dim XmlDoc 
    Dim fso 'fso对象 
Dim objFolder '文件夹对象 
Dim objSubFolders '子文件夹集合 
Dim objSubFolder '子文件夹对象 
Dim objFiles '文件集合 
Dim objFile '文件对象 
Dim objStream 
    Dim pathname, TextStream, pp, Xfolder, Xfpath, Xfile, Xpath, Xstream 
    Dim PathNameStr 
    response.Write("=========="&DirPath&"==========<br>") 
Set fso = server.CreateObject("scripting.filesystemobject") 
Set objFolder = fso.GetFolder(DirPath)'创建文件夹对象 

    Response.Write DirPath 
    Response.flush 

    Set XmlDoc = Server.CreateObject("Microsoft.XMLDOM") 
    XmlDoc.load Server.MapPath(ZipPathFile) 
    XmlDoc.async =False 

'写入每个文件夹路径 
Set Xfolder = XmlDoc.SelectSingleNode("//root").AppendChild(XmlDoc.CreateElement("folder")) 
Set Xfpath = Xfolder.AppendChild(XmlDoc.CreateElement("path")) 
    Xfpath.text = Replace(DirPath, ZipPathDir,"") 
Set objFiles = objFolder.Files 
    ForEach objFile in objFiles 
        If LCase(DirPath & objFile.Name)<> LCase(Request.ServerVariables("PATH_TRANSLATED"))Then 

(编辑:汽车网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章