How to generate XML files dynamically using ASP

Source: Internet
Author: User
Function Replacechar (Fstrsource)
Dim strret
If IsNull (Fstrsource) Then
Fstrsource = ""
End If
strret = Replace (Fstrsource, "&", "&")
strret = Replace (strret, "<", "&lt;")
strret = Replace (strret, ">", "&gt;")
strret = Replace (Strret, "" "", "&quot;")
strret = Replace (strret, "'", "&apos;")
Replacechar = strret
End Function
function Rsttoxml (Frstrst, Fstrrstname)
Dim Strspace ' Space String behand of element
Dim Intlevel ' Level of the element
Dim Strxml ' The Return string (XML string)
Dim Intrstfield
Dim strshortdate

' Document level
Intlevel = 0
Strspace = Space (Intlevel * 2)
If Len (fstrrstname) >0 Then
Strxml=strspace & "<" & Fstrrstname & ">" & vbcr
Intlevel = intlevel + 1
Strspace = Space (intlevel*2)
End If
If Frstrst.eof Then
Strxml = strxml&strspace & "<record"
For ncount=0 to Frstrst.fields.count-1
Strxml = strxml & Space (1) &frstrst.fields (ncount). name& "=" "
Next
Strxml = strxml & "/>" &vbcr
If Len (fstrrstname) >0 Then
Strxml=strxml&strspace & "</" & Fstrrstname & ">" & vbcr
End If
Rsttoxml=strxml
Exit function
End If
' Now move at one level
Intlevel = intlevel + 1
Strspace = Space (Intlevel * 2)

' Loop through the records
Dim strtemp
Frstrst.movefirst
Do as not frstrst.eof
strtemp = ""
' Loop through the fields
' Strxml = strxml & strspace & ' <record '

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.