ASP常用函数:ArrayToxml
发布时间:2016-12-29 来源:查字典编辑
摘要:
<%
PublicFunctionArrayToxml(DataArray,Recordset,row,xmlroot)
Dimi,node,rs,j
Ifxmlroot=""Thenxmlroot="xml"
SetArrayToxml=Server.CreateObject("msxml2.FreeThreadedDOMDocument"&MsxmlVersion)
ArrayToxml.appendChild(ArrayToxml.createElement(xmlroot))
Ifrow=""Thenrow="row"
Fori=0ToUBound(DataArray,2)
SetNode=ArrayToxml.createNode(1,row,"")
j=0
ForEachrsinRecordset.Fields
node.Attributes.setNamedItem(ArrayToxml.createNode(2,LCase(rs.Name),"")).text=DataArray(j,i)&""
j=j+1
Next
ArrayToxml.documentElement.appendChild(Node)
Next
EndFunction
%>