ASP常用函数:ArrayToxml
时间:2019-10-24 11:26 来源/作者:asp技术网
-
<%
-
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
-
%>
相关文章
热门资讯