如何用Asp动态生成xml文件
function replacechar ( fstrsource )
dim strret
if isnull(fstrsource) then
fstrsource = ""
end if
strret = replace ( fstrsource , "&" , "&" )
strret = replace ( strret , "<" , "<" )
strret = replace ( strret , ">" , ">" )
strret = replace ( strret , """" , """ )
strret = replace ( strret , "" , "'" )
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 in one level
intlevel = intlevel + 1
strspace = space (intlevel * 2)
loop through the records
dim strtemp
frstrst.movefirst
do while not frstrst.eof
strtemp = ""
loop through the fields
strxml(标准化越来越近了) = strxml(标准化越来越近了) & strspace & "<record"
for each objfield in frstrst.fields
set objfield = frstrst.fields(intrstfield)
strtemp = strtemp & space (1) & objfield.name & "="
strtemp = strtemp & """" & replacechar(objfield.value) & """"
end if
next
strxml(标准化越来越近了) = strxml(标准化越来越近了) & "<record "&strtemp& "/>" & vbcr
frstrst.movenext
loop
intlevel=intlevel-1
strspace=space(intlevel * 2)
if len(fstrrstname)>0 then
strxml(标准化越来越近了) = strxml(标准化越来越近了) & strspace & "</" & fstrrstname & ">" & vbcr
end if
rsttoxml(标准化越来越近了) = strxml(标准化越来越近了)
下一篇: 字体设计:造字方法和添加字体效果