asp源码打包成xml的工具(2)
Response.Write "---<br/>"
PathNameStr = DirPath &""& objFile.Name
Response.Write PathNameStr &""
Response.flush
'================================================
'写入文件的路径及文件内容
Set Xfile = XmlDoc.SelectSingleNode("//root").AppendChild(XmlDoc.CreateElement("file"))
Set Xpath = Xfile.AppendChild(XmlDoc.CreateElement("path"))
Xpath.text = Replace(PathNameStr, ZipPathDir,"")
'创建文件流读入文件内容,并写入XML文件中
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type=1
objStream.Open()
objStream.LoadFromFile(PathNameStr)
objStream.position =0
Set Xstream = Xfile.AppendChild(XmlDoc.CreateElement("stream"))
Xstream.SetAttribute "xmlns:dt","urn:schemas-microsoft-com:datatypes"
'文件内容采用二制方式存放
Xstream.dataType ="bin.base64"
Xstream.nodeTypedValue = objStream.Read()
Set objStream =Nothing
Set Xpath =Nothing
Set Xstream =Nothing
Set Xfile =Nothing
'================================================
EndIf
Next
Response.Write "<p>"
XmlDoc.Save(Server.Mappath(ZipPathFile))
Set Xfpath =Nothing
Set Xfolder =Nothing
Set XmlDoc =Nothing
'创建的子文件夹对象
Set objSubFolders = objFolder.SubFolders
'调用递归遍历子文件夹
ForEach objSubFolder in objSubFolders
pathname = DirPath & objSubFolder.Name &"\"
LoadData(pathname)
内容版权声明:除非注明,否则皆为本站原创文章。