ASP常用函数:ArrayToxml
(编辑:jimmy 日期: 2024/11/8 浏览:3 次 )
<%
Public Function ArrayToxml(DataArray, Recordset, row, xmlroot)
Dim i, node, rs, j
If xmlroot = "" Then xmlroot = "xml"
Set ArrayToxml = Server.CreateObject("msxml2.FreeThreadedDOMDocument"& MsxmlVersion)
ArrayToxml.appendChild(ArrayToxml.createElement(xmlroot))
If row = "" Then row = "row"
For i = 0 To UBound(DataArray, 2)
Set Node = ArrayToxml.createNode(1, row, "")
j = 0
For Each rs in Recordset.Fields
node.Attributes.setNamedItem(ArrayToxml.createNode(2, LCase(rs.Name), "")).text = DataArray(j, i)& ""
j = j + 1
Next
ArrayToxml.documentElement.appendChild(Node)
Next
End Function
%>
Public Function ArrayToxml(DataArray, Recordset, row, xmlroot)
Dim i, node, rs, j
If xmlroot = "" Then xmlroot = "xml"
Set ArrayToxml = Server.CreateObject("msxml2.FreeThreadedDOMDocument"& MsxmlVersion)
ArrayToxml.appendChild(ArrayToxml.createElement(xmlroot))
If row = "" Then row = "row"
For i = 0 To UBound(DataArray, 2)
Set Node = ArrayToxml.createNode(1, row, "")
j = 0
For Each rs in Recordset.Fields
node.Attributes.setNamedItem(ArrayToxml.createNode(2, LCase(rs.Name), "")).text = DataArray(j, i)& ""
j = j + 1
Next
ArrayToxml.documentElement.appendChild(Node)
Next
End Function
%>
下一篇:ASP常用函数:IIF()