ASP +access generate XML document instance code

Source: Internet
Author: User

<?xml version= "1.0" encoding= "Utf-8"?>
<photos>
<photo filename= "The path of the big picture" thumbnail= "The path of the small map" description= "Picture expression"/>
</photos>


<%
Dim sSQL
Dim rs
Dim Scrlf
Dim sxmlclear
Dim srsshead
Dim srssend
SCRLF = Chr &CHR (10) ' Carriage return + linefeed
Sxmlclear = sxmlclear & <?xml version= ' 1.0 ' encoding= ' utf-8 '?> ' & Scrlf
Srsshead = "<photos ' >" & SCRLF
Srsshead = srsshead & "<photo filename=" 1 "thumbnail=" 2 "description=" 3 "/>" & Scrlf
Srssend = "</photos>"
Response.charset= "gb2312" dataset
Response.contenttype= "text/xml" Data flow format definition
Output
Response.Write Sxmlclear
Response.Write Srsshead

OpenData
Ssql= "SELECT * from P_MXDP"
Set rs = Server.CreateObject ("ADODB.") Recordset ")
Rs. Open sSQL, conn,1,1
If not (rs.eof and RS.BOF) then
Do as not rs.eof
Listinfo=listinfo & "<item>" & Scrlf
Listinfo=listinfo & "<photo filename=" "& RS (" B_pic ") &" Thumbnail= "" & RS ("S_pic") & "" Descri Ption= "" & RS ("DECC") & "/>" & Scrlf
Listinfo=listinfo & "</item>" & Scrlf & Scrlf
Rs.movenext
Loop
End If
Rs.close
Set rs=nothing
Response.Write Srssend
Body=sxmlclear&srsshead&listinfo&srssend
WriteXml ". /ph.xml ", body

function WriteXml (filename,bodytext)
Set FSO = Server.CreateObject ("Scripting.FileSystemObject")
Set fout = fso. CreateTextFile (Server.MapPath (filename), true)
Fout. WriteLine BodyText
Fout.close
End Function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.