如何用Asp动态生成xml文件

2018-09-06 10:41

阅读:587

  Function ReplaceChar ( FstrSource )
dim strRet
if IsNull(FstrSource) then
FstrSource =
end if
strRet = Replace ( FstrSource , , amp; )
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
strxml(标准化越来越近了) = strxml(标准化越来越近了)
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(标准化越来越近了)


评论


亲,登录后才可以留言!