Content feed Comments Feed

The Official ASATO Site

Hi, welcome to my blog. ASP,asp.net,Health,Javascript,JQUERY

Create a xml file with asp!

Posted by admin On April - 14 - 2010

The following example shows how to create a XML file with asp.
First, we write a function named “CreateXml”

?View Code CSHARP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
	sub CreateXml(FilePath)
		startime=timer()
		dim XmlDoc,Root
		Set XmlDoc = Server.CreateObject("Microsoft.XMLDOM")
			XmlDoc.async = False
			Set Root = XmlDoc.createProcessingInstruction("xml","version='1.0' encoding='UTF-8'")
			XmlDoc.appendChild(Root)
			XmlDoc.appendChild(XmlDoc.CreateElement("files"))
			XmlDoc.Save(Server.MapPath(FilePath))
			Set Root = Nothing
		Set XmlDoc = Nothing
		LoadData(ZipPathDir)
		endtime=timer()
		response.Write("<span style=' color:#ff0000;'>time:" & FormatNumber((endtime-startime),3) & "s</span>")
 
	End sub

then,we can use it to create xml file.

?View Code CSHARP
1
2
3
Dim ZipPathFile
ZipPathFile = "update.xml"
CreateXml(ZipPathFile)

Comments are closed.