三、ASP版源代码
<%
dim strf
strf = request("file")
dim strResult
strFilePath = Server.MapPath(strf)
'dim domXMLData  As New Msxml2.FreeThreadedDOMDocument
dim domXMLData 
set domXMLData = Server.CreateObject("Microsoft.XMLDOM")'As New Msxml2.DOMDocument
if strFilePath="" then    
    txtData.innerHTML=strFilePath+"<p><font color=""red""><b>请浏览选择需要察看的xml文件. :)</b></font> </p>" 
else
    domXMLData.load(strFilePath)
    if (domXMLData.parseError.errorCode <> 0) then
        strResult ="<p><font color=""red""><b>Invalid XML file:</b></font> " & domXMLData.parseError.reason & "</p>"
    else
        '递归遍历不同类型子节点,加上高亮标记 (<font color=#> </font>)
        strResult = renderChildNodes(domXMLData, 0)
    end if
end if
'函数名:renderChildNodes
'参数:nodNode -- xml 节点
'        intLevel -- 层数,用于缩进
function renderChildNodes(nodNode, intLevel)
    dim strNodes,intCount,intNode
    strNodes = "" '用于显示的 html 字符串,处理的结果
    intCount = 0  '循环遍历用的临时变量
    intNode = 0   '循环遍历用的临时变量
    dim nodAttrList   '属性集
    dim intNodeType
    intNodeType = nodNode.nodeType
    select case intnodeType
    
        case 3: '文本节点, 黑色 粗体显示
                strNodes=strNodes & getIndent(intLevel) & "<b>"& nodNode.text & "</b><br>"
                
        case 7: '指令节点 , 调用子函数
                strNodes=strNodes & renderInstruction(nodNode,intLevel)
                
        case 8: '注释节点 , 调用子节点
                strNodes=strNodes & renderComment(nodNode,intLevel)
 






                                账号登录