当前位置:首页 > ASP教程 > ASP基础

ASP常用函数:ArrayToxml

<%
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
%>


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!