Liu Yongfa の XML ASP ソース コード パッケージ ツールは、別の XML ファイルにパッケージ化されており、ファイルをパッケージ化するときにサーバーに直接インストールして、Pack.asp として保存できます。
次のようにコードをコピーします。
<%@LANGUAGE=VBSCRIPT コードページ=65001%>
<%OptionExplicit%>
<%OnErrorResumeNext%>
<% Response.Charset=UTF-8%>
<% Server.ScriptTimeout=99999999%>
<!DOCTYPEhtmlPUBLIC-//W3C//DTDXHTML1.0Transitional//ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
<htmlxmlns=http://www.w3.org/1999/xhtml>
<頭>
<metahttp-equiv=Content-Typecontent=text/html;
<title>ファイル パッケージ プログラム</title>
</head>
<本文>
<%
Dim ZipPathDir、ZipPathFile
薄暗い開始時間、終了時間
'ここでパッケージ化するフォルダーのパスを変更します
ZipPathDir =F:/www.yongfa365.com'
ZipPathFile =update.xml
正しい場合(ZipPathDir,1)<>/その後、ZipPathDir = ZipPathDir&/
「荷造りを始めましょう」
CreateXml(ZipPathFile)
'ディレクトリ内のすべてのファイルとフォルダーをスキャンします
サブ LoadData(DirPath)
DimXmlDoc
Dim fso 'fso オブジェクト
Dim objFolder 'フォルダーオブジェクト
Dim objSubFolders 'サブフォルダー コレクション
Dim objSubFolder 'サブフォルダー オブジェクト
Dim objFiles 'ファイルコレクション
Dim objFile 'ファイルオブジェクト
薄暗いobjStream
Dim パス名、TextStream、pp、Xfolder、Xfpath、Xfile、Xpath、Xstream
DimPathNameStr
response.Write(==========&DirPath&==========<br>)
fso = サーバー.CreateObject(scripting.filesystemobject) を設定します。
Set objFolder = fso.GetFolder(DirPath)' フォルダー オブジェクトを作成します
Response.DirPath の書き込み
レスポンス.フラッシュ
XmlDoc = Server.CreateObject(Microsoft.XMLDOM) を設定します。
XmlDoc.load Server.MapPath(ZipPathFile)
XmlDoc.async =False
'各フォルダのパスを書きます
Set Xfolder = XmlDoc.SelectSingleNode(//root).AppendChild(XmlDoc.CreateElement(folder))
Xfpath = Xfolder.AppendChild(XmlDoc.CreateElement(path)) を設定します。
Xfpath.text = Replace(DirPath, ZipPathDir,)
objFiles = objFolder.Files を設定します
objFiles の ForEach objFile
If LCase(DirPath & objFile.Name)<> LCase(Request.ServerVariables(PATH_TRANSLATED))Then
応答.書き込み ---<br/>
PathNameStr = DirPath && objFile.Name
Response.Write PathNameStr &
レスポンス.フラッシュ
'===============================================
'ファイルのパスとファイル内容を書き込みます
Set Xfile = XmlDoc.SelectSingleNode(//root).AppendChild(XmlDoc.CreateElement(file))
Xpath = Xfile.AppendChild(XmlDoc.CreateElement(path)) を設定します。
Xpath.text = Replace(PathNameStr, ZipPathDir,)
'ファイルの内容を読み取り、XML ファイルに書き込むためのファイル ストリームを作成します。
objStream = Server.CreateObject(ADODB.Stream) を設定します。
objStream.Type=1
objStream.Open()
objStream.LoadFromFile(PathNameStr)
objStream.position =0
Xstream = Xfile.AppendChild(XmlDoc.CreateElement(stream)) を設定します。
Xstream.SetAttribute xmlns:dt,urn:schemas-microsoft-com:datatypes
'ファイルの内容はバイナリモードで保存されます
Xstream.dataType =bin.base64
Xstream.nodeTypedValue = objStream.Read()
objStream =Nothing を設定します
Xpath =Nothing を設定します
Xstream =Nothing を設定します
Xfile=Nothing を設定します
'===============================================
EndIf
次
応答.書き込み<p>
XmlDoc.Save(Server.Mappath(ZipPathFile))
Xfpath =Nothing を設定します
Xfolder =Nothing を設定します
XmlDoc =Nothing を設定します
'サブフォルダーオブジェクトを作成しました
objSubFolders = objFolder.SubFolders を設定します
'サブフォルダーを再帰的に呼び出します
objSubFolders の ForEach objSubFolder
パス名 = DirPath & objSubFolder.Name &/
LoadData(パス名)
次
objFolder =Nothing を設定します
objSubFolders =Nothing を設定します
fso=何も設定しない
EndSub
'ファイルへの書き込みを準備するために空の XML ファイルを作成します
サブ CreateXml(ファイルパス)
'プログラム開始実行時間
スタータイム = タイマー()
Dim XmlDoc、ルート
XmlDoc = Server.CreateObject(Microsoft.XMLDOM) を設定します。
XmlDoc.async =False
Set Root = XmlDoc.createProcessingstruct(xml,version='1.0' エンコーディング='UTF-8')
XmlDoc.appendChild(ルート)
XmlDoc.appendChild(XmlDoc.CreateElement(root))
XmlDoc.Save(Server.MapPath(FilePath))
ルート = なしを設定します
XmlDoc =Nothing を設定します
LoadData(ZipPathDir)
'番組終了時刻
終了時間 = タイマー()
response.Write(ページ実行時間: & FormatNumber((終了時間 - 開始時間),3)& 秒)
EndSub
%>
</body>
</html>
以下を Install.asp として保存し、XML パッケージ ファイルをインストールするときに実行します。
次のようにコードをコピーします。
<%@LANGUAGE=VBSCRIPT コードページ=65001%>
<%OptionExplicit%>
<%OnErrorResumeNext%>
<% Response.Charset=UTF-8%>
<% Server.ScriptTimeout=99999999%>
<!DOCTYPEhtmlPUBLIC-//W3C//DTDXHTML1.0Transitional//ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
<htmlxmlns=http://www.w3.org/1999/xhtml>
<頭>
<metahttp-equiv=Content-Typecontent=text/html;
<title>ファイル解凍ツール</title>
</head>
<本文>
<%
Dim strLocalPath
'現在のフォルダーの物理パスを取得します
strLocalPath = Left(Request.ServerVariables(PATH_TRANSLATED), InStrRev(Request.ServerVariables(PATH_TRANSLATED),/))
Dim objXmlFile
Dim objNodeList
薄暗いobjFSO
薄暗いobjStream
薄暗いi、j
objXmlFile = Server.CreateObject(Microsoft.XMLDOM) を設定します。
objXmlFile.load(Server.MapPath(update.xml))
objXmlFile.readyState =4の場合
objXmlFile.parseError.errorCode =0の場合
set objNodeList = objXmlFile.documentElement.selectNodes(//フォルダー/パス)
objFSO = CreateObject(Scripting.FileSystemObject) を設定します。
j = objNodeList.Length -1
For i =0To j
objFSO.FolderExists(strLocalPath & objNodeList(i).text)=Falseの場合
objFSO.CreateFolder(strLocalPath & objNodeList(i).text)
EndIf
Response.Write はディレクトリ & objNodeList(i).text &<br/> を作成します
レスポンス.フラッシュ
次
objFSO =Nothing を設定します
objNodeList =Nothing を設定します
set objNodeList = objXmlFile.documentElement.selectNodes(//ファイル/パス)
j = objNodeList.Length -1
For i =0To j
objStream = CreateObject(ADODB.Stream) を設定します。
objStreamを使用する場合
.Type=1
。開ける
.Write objNodeList(i).nextSibling.nodeTypedvalue
.SaveToFile strLocalPath & objNodeList(i).text,2
Response.Write はファイル & objNodeList(i).text &<br/> をリリースします
レスポンス.フラッシュ
。近い
EndWith
objStream =Nothing を設定します
次
objNodeList =Nothing を設定します
EndIf
EndIf
objXmlFile =Nothing を設定します
応答。書き込みファイルの解凍が完了しました
%>
</body>
</html>