1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
<%@LANGUAGE="VBSCRIPT"%>
<%
Response.ContentType="text/XML"
Dim objDom
Dim objRoot
.....
filePath = Server.MapPath("BDPhotographers.mdb")
Set Connection=Server.CreateObject("ADODB.Connection")
Connection.Open="Provider=Microsoft.jet.OLEDB.4.0;Data source="&filepath
sql="SELECT * From Photos"
set obj_Recordset=Server.CreateObject("ADODB.Recordset")
obj_Recordset.open sql, Connection
IF not obj_Recordset.EOF then
Set objDom = Server.CreateObject("Microsoft.XMLDOM")
objDom.preserveWhiteSpace = True
Set objRoot = objDom.createElement("gallery")
objDom.appendChild objRoot
obj_Recordset.MoveFirst
DO WHILE NOT obj_Recordset.EOF
Set objChild1 = objDom.createElement("galleryName")
objChild1.Text=Request.Form("gal1")
objRoot.appendChild objChild1
Set objChild2 = objDom.createElement("images")
objRoot.appendChild objChild2
Set objChild3 = objDom.createElement("image")
objChild2.appendChild objChild3
Set objChild4 = objDom.createElement("filename")
objChild4.Text=Request.Form("file1")
objChild3.appendChild objChild4
Set objChild5 = objDom.createElement("description")
objChild5.Text=Request.Form("desc1")
objChild3.appendChild objChild5
Set objChild6 = objDom.createElement("date")
objChild6.Text=Request.Form("date1")
objChild3.appendChild objChild6
obj_Recordset.MoveNext
LOOP
END IF
Set objPI = objDom.createProcessingInstruction("xml", "version='1.0' encoding='UTF-8' ")
objDom.insertBefore objPI, objDom.childNodes(0)
objDom.Save "C:\Inetpub\wwwroot\WebProject\photoGal.xml"
%> |