{"id":60,"date":"2007-09-08T11:09:38","date_gmt":"2007-09-08T03:09:38","guid":{"rendered":"http:\/\/www.cnmiss.cn\/?p=59"},"modified":"2010-12-02T06:31:28","modified_gmt":"2010-12-02T06:31:28","slug":"asp%e6%ba%90%e7%a0%81%e6%89%93%e5%8c%85%e5%b7%a5%e5%85%b7%ef%bc%8c%e6%89%93%e5%8c%85%e6%88%90%e5%8d%95%e7%8b%ac%e7%9a%84xml%e6%96%87%e4%bb%b6%ef%bc%8c%e5%8f%af%e4%bb%a5%e5%9c%a8%e6%9c%8d%e5%8a%a1","status":"publish","type":"post","link":"https:\/\/www.cnmiss.cn\/?p=60","title":{"rendered":"Asp\u6e90\u7801\u6253\u5305\u5de5\u5177\uff0c\u6253\u5305\u6210\u5355\u72ec\u7684xml\u6587\u4ef6\uff0c\u53ef\u4ee5\u5728\u670d\u52a1\u5668\u4e0a\u76f4\u63a5\u5b89\u88c5"},"content":{"rendered":"<p>\u4e0b\u8fb9\u8fd9\u4e2a\u5b58\u4e3aPack.asp,\u6253\u5305\u6587\u4ef6\u65f6\u8fd0\u884c<\/p>\n<blockquote><p>&lt;%@LANGUAGE=&quot;VBSCRIPT&quot; CODEPAGE=&quot;65001&quot;%&gt;<br \/>&lt;% Option Explicit %&gt;<br \/>&lt;% On Error Resume Next %&gt;<br \/>&lt;% Response.Charset=&quot;UTF-8&quot; %&gt;<br \/>&lt;% Server.ScriptTimeout=99999999 %&gt;<br \/>&lt;!DOCTYPE html PUBLIC &quot;-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN&quot; &quot;http&#58;\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd&quot;&gt;<br \/>&lt;html xmlns=&quot;http&#58;\/\/www.w3.org\/1999\/xhtml&quot;&gt;<br \/>&lt;head&gt;<br \/>&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text\/html; charset=utf-8&quot; \/&gt;<br \/>&lt;title&gt;\u6587\u4ef6\u6253\u5305\u7a0b\u5e8f&lt;\/title&gt;<br \/>&lt;\/head&gt;<\/p>\n<p>&lt;body&gt;<br \/>&lt;%<\/p>\n<p>Dim ZipPathDir, ZipPathFile<br \/>Dim startime, endtime<br \/>&#39;\u5728\u6b64\u66f4\u6539\u8981\u6253\u5305\u6587\u4ef6\u5939\u7684\u8def\u5f84<br \/>ZipPathDir = &quot;F:\\www.yongfa365.com&quot;&#39;<br \/>ZipPathFile = &quot;update.xml&quot;<br \/>If Right(ZipPathDir, 1)&lt;&gt;&quot;\\&quot; Then ZipPathDir = ZipPathDir&#038;&quot;\\&quot;<br \/>&#39;\u5f00\u59cb\u6253\u5305<br \/>CreateXml(ZipPathFile)<br \/>&#39;\u904d\u5386\u76ee\u5f55\u5185\u7684\u6240\u6709\u6587\u4ef6\u4ee5\u53ca\u6587\u4ef6\u5939<\/p>\n<p>Sub LoadData(DirPath)<br \/>    Dim XmlDoc<br \/>    Dim fso &#39;fso\u5bf9\u8c61<br \/>    Dim objFolder &#39;\u6587\u4ef6\u5939\u5bf9\u8c61<br \/>    Dim objSubFolders &#39;\u5b50\u6587\u4ef6\u5939\u96c6\u5408<br \/>    Dim objSubFolder &#39;\u5b50\u6587\u4ef6\u5939\u5bf9\u8c61<br \/>    Dim objFiles &#39;\u6587\u4ef6\u96c6\u5408<br \/>    Dim objFile &#39;\u6587\u4ef6\u5bf9\u8c61<br \/>    Dim objStream<br \/>    Dim pathname, TextStream, pp, Xfolder, Xfpath, Xfile, Xpath, Xstream<br \/>    Dim PathNameStr<br \/>    response.Write(&quot;==========&quot;&#038;DirPath&#038;&quot;==========&lt;br&gt;&quot;)<br \/>    Set fso = server.CreateObject(&quot;scripting.filesystemobject&quot;)<br \/>    Set objFolder = fso.GetFolder(DirPath)&#39;\u521b\u5efa\u6587\u4ef6\u5939\u5bf9\u8c61<\/p>\n<p>    Response.Write DirPath<br \/>    Response.flush<\/p>\n<p>    Set XmlDoc = Server.CreateObject(&quot;Microsoft.XMLDOM&quot;)<br \/>    XmlDoc.load Server.MapPath(ZipPathFile)<br \/>    XmlDoc.async = False<\/p>\n<p>    &#39;\u5199\u5165\u6bcf\u4e2a\u6587\u4ef6\u5939\u8def\u5f84<br \/>    Set Xfolder = XmlDoc.SelectSingleNode(&quot;\/\/root&quot;).AppendChild(XmlDoc.CreateElement(&quot;folder&quot;))<br \/>    Set Xfpath = Xfolder.AppendChild(XmlDoc.CreateElement(&quot;path&quot;))<br \/>    Xfpath.text = Replace(DirPath, ZipPathDir, &quot;&quot;)<br \/>    Set objFiles = objFolder.Files<br \/>    For Each objFile in objFiles<br \/>        If LCase(DirPath &#038; objFile.Name) &lt;&gt; LCase(Request.ServerVariables(&quot;PATH_TRANSLATED&quot;)) Then<br \/>            Response.Write &quot;&#8212;&lt;br\/&gt;&quot;<br \/>            PathNameStr = DirPath &#038; &quot;&quot; &#038; objFile.Name<br \/>            Response.Write PathNameStr &#038; &quot;&quot;<br \/>            Response.flush<br \/>            &#39;================================================<br \/>            &#39;\u5199\u5165\u6587\u4ef6\u7684\u8def\u5f84\u53ca\u6587\u4ef6\u5185\u5bb9<br \/>            Set Xfile = XmlDoc.SelectSingleNode(&quot;\/\/root&quot;).AppendChild(XmlDoc.CreateElement(&quot;file&quot;))<br \/>            Set Xpath = Xfile.AppendChild(XmlDoc.CreateElement(&quot;path&quot;))<br \/>            Xpath.text = Replace(PathNameStr, ZipPathDir, &quot;&quot;)<br \/>            &#39;\u521b\u5efa\u6587\u4ef6\u6d41\u8bfb\u5165\u6587\u4ef6\u5185\u5bb9\uff0c\u5e76\u5199\u5165XML\u6587\u4ef6\u4e2d<br \/>            Set objStream = Server.CreateObject(&quot;ADODB.Stream&quot;)<br \/>            objStream.Type = 1<br \/>            objStream.Open()<br \/>            objStream.LoadFromFile(PathNameStr)<br \/>            objStream.position = 0<\/p>\n<p>            Set Xstream = Xfile.AppendChild(XmlDoc.CreateElement(&quot;stream&quot;))<br \/>            Xstream.SetAttribute &quot;xmlns:dt&quot;, &quot;urn:schemas-microsoft-com:datatypes&quot;<br \/>            &#39;\u6587\u4ef6\u5185\u5bb9\u91c7\u7528\u4e8c\u5236\u65b9\u5f0f\u5b58\u653e<br \/>            Xstream.dataType = &quot;bin.base64&quot;<br \/>            Xstream.nodeTypedValue = objStream.Read()<\/p>\n<p>            Set objStream = Nothing<br \/>            Set Xpath = Nothing<br \/>            Set Xstream = Nothing<br \/>            Set Xfile = Nothing<br \/>            &#39;================================================<br \/>        End If<br \/>    Next<br \/>    Response.Write &quot;&lt;p&gt;&quot;<br \/>    XmlDoc.Save(Server.Mappath(ZipPathFile))<br \/>    Set Xfpath = Nothing<br \/>    Set Xfolder = Nothing<br \/>    Set XmlDoc = Nothing<\/p>\n<p>    &#39;\u521b\u5efa\u7684\u5b50\u6587\u4ef6\u5939\u5bf9\u8c61<br \/>    Set objSubFolders = objFolder.SubFolders<br \/>    &#39;\u8c03\u7528\u9012\u5f52\u904d\u5386\u5b50\u6587\u4ef6\u5939<br \/>    For Each objSubFolder in objSubFolders<br \/>        pathname = DirPath &#038; objSubFolder.Name &#038; &quot;\\&quot;<br \/>        LoadData(pathname)<br \/>    Next<br \/>    Set objFolder = Nothing<br \/>    Set objSubFolders = Nothing<br \/>    Set fso = Nothing<\/p>\n<p>End Sub<\/p>\n<p>&#39;\u521b\u5efa\u4e00\u4e2a\u7a7a\u7684XML\u6587\u4ef6\uff0c\u4e3a\u5199\u5165\u6587\u4ef6\u4f5c\u51c6\u5907<\/p>\n<p>Sub CreateXml(FilePath)<br \/>    &#39;\u7a0b\u5e8f\u5f00\u59cb\u6267\u884c\u65f6\u95f4<br \/>    startime = Timer()<br \/>    Dim XmlDoc, Root<br \/>    Set XmlDoc = Server.CreateObject(&quot;Microsoft.XMLDOM&quot;)<br \/>    XmlDoc.async = False<br \/>    Set Root = XmlDoc.createProcessingInstruction(&quot;xml&quot;, &quot;version=&#39;1.0&#39; encoding=&#39;UTF-8&#39;&quot;)<br \/>    XmlDoc.appendChild(Root)<br \/>    XmlDoc.appendChild(XmlDoc.CreateElement(&quot;root&quot;))<br \/>    XmlDoc.Save(Server.MapPath(FilePath))<br \/>    Set Root = Nothing<br \/>    Set XmlDoc = Nothing<br \/>    LoadData(ZipPathDir)<br \/>    &#39;\u7a0b\u5e8f\u7ed3\u675f\u65f6\u95f4<br \/>    endtime = Timer()<br \/>    response.Write(&quot;\u9875\u9762\u6267\u884c\u65f6\u95f4\uff1a&quot; &#038; FormatNumber((endtime &#8211; startime), 3) &#038; &quot;\u79d2&quot;)<br \/>End Sub<\/p>\n<p>%&gt;<br \/>&lt;\/body&gt;<br \/>&lt;\/html&gt;<\/p><\/blockquote>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\u4e0b\u8fb9\u8fd9\u4e2a\u5b58\u4e3aInstall.asp,\u5b89\u88c5XML\u6253\u5305\u6587\u4ef6\u65f6\u8fd0\u884c<\/p>\n<blockquote><p>&lt;%@LANGUAGE=&quot;VBSCRIPT&quot; CODEPAGE=&quot;65001&quot;%&gt;<br \/>&lt;% Option Explicit %&gt;<br \/>&lt;% On Error Resume Next %&gt;<br \/>&lt;% Response.Charset=&quot;UTF-8&quot; %&gt;<br \/>&lt;% Server.ScriptTimeout=99999999 %&gt;<br \/>&lt;!DOCTYPE html PUBLIC &quot;-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN&quot; &quot;http&#58;\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd&quot;&gt;<br \/>&lt;html xmlns=&quot;http&#58;\/\/www.w3.org\/1999\/xhtml&quot;&gt;<br \/>&lt;head&gt;<br \/>&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text\/html; charset=utf-8&quot; \/&gt;<br \/>&lt;title&gt;\u6587\u4ef6\u89e3\u5305\u7a0b\u5e8f&lt;\/title&gt;<br \/>&lt;\/head&gt;<\/p>\n<p>&lt;body&gt;<br \/>&lt;%<br \/>Dim strLocalPath<br \/>&#39;\u5f97\u5230\u5f53\u524d\u6587\u4ef6\u5939\u7684\u7269\u7406\u8def\u5f84<br \/>strLocalPath = Left(Request.ServerVariables(&quot;PATH_TRANSLATED&quot;), InStrRev(Request.ServerVariables(&quot;PATH_TRANSLATED&quot;), &quot;\\&quot;))<\/p>\n<p>Dim objXmlFile<br \/>Dim objNodeList<br \/>Dim objFSO<br \/>Dim objStream<br \/>Dim i, j<\/p>\n<p>Set objXmlFile = Server.CreateObject(&quot;Microsoft.XMLDOM&quot;)<br \/>objXmlFile.load(Server.MapPath(&quot;update.xml&quot;))<\/p>\n<p>If objXmlFile.readyState = 4 Then<br \/>    If objXmlFile.parseError.errorCode = 0 Then<\/p>\n<p>        Set objNodeList = objXmlFile.documentElement.selectNodes(&quot;\/\/folder\/path&quot;)<br \/>        Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)<\/p>\n<p>        j = objNodeList.Length -1<br \/>        For i = 0 To j<br \/>            If objFSO.FolderExists(strLocalPath &#038; objNodeList(i).text) = False Then<br \/>                objFSO.CreateFolder(strLocalPath &#038; objNodeList(i).text)<br \/>            End If<br \/>            Response.Write &quot;\u521b\u5efa\u76ee\u5f55&quot; &#038; objNodeList(i).text &#038; &quot;&lt;br\/&gt;&quot;<br \/>            Response.Flush<br \/>        Next<br \/>        Set objFSO = Nothing<br \/>        Set objNodeList = Nothing<br \/>        Set objNodeList = objXmlFile.documentElement.selectNodes(&quot;\/\/file\/path&quot;)<\/p>\n<p>        j = objNodeList.Length -1<br \/>        For i = 0 To j<br \/>            Set objStream = CreateObject(&quot;ADODB.Stream&quot;)<br \/>            With objStream<br \/>                .Type = 1<br \/>                .Open<br \/>\n          .Write objNodeList(i).nextSibling.nodeTypedvalue<br \/>                .SaveToFile strLocalPath &#038; objNodeList(i).text, 2<br \/>                Response.Write &quot;\u91ca\u653e\u6587\u4ef6&quot; &#038; objNodeList(i).text &#038; &quot;&lt;br\/&gt;&quot;<br \/>                Response.Flush<br \/>                .Close<br \/>            End With<br \/>            Set objStream = Nothing<br \/>        Next<br \/>        Set objNodeList = Nothing<br \/>    End If<br \/>End If<\/p>\n<p>Set objXmlFile = Nothing<\/p>\n<p>response.Write &quot;\u6587\u4ef6\u89e3\u5305\u5b8c\u6bd5&quot;<br \/>%&gt;<br \/>&lt;\/body&gt;<br \/>&lt;\/html&gt;<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0b\u8fb9\u8fd9\u4e2a\u5b58\u4e3aPack.asp,\u6253\u5305\u6587\u4ef6\u65f6\u8fd0\u884c &lt;%@LANGUAGE=&#038;q &hellip; <a href=\"https:\/\/www.cnmiss.cn\/?p=60\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[13],"class_list":["post-60","post","type-post","status-publish","format-standard","hentry","category-xxbj","tag-asp"],"_links":{"self":[{"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=\/wp\/v2\/posts\/60","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=60"}],"version-history":[{"count":0,"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=\/wp\/v2\/posts\/60\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=60"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=60"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cnmiss.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=60"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}