敬业的IT人 >> 网站建设 >> Web编程 >> Asp >> 如何用Asp动态生成xml文件

如何用Asp动态生成xml文件

敬业的IT人 互联网 佚名 2008-4-14 12:13:37

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 in""" & 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(标准化越来越近了)

粤ICP备06119539号
Copyright CiscoSky.Org,Some Rights Reserved.
Email:me1228#tom.com