VC语言

本类阅读TOP10

·VC++ 学习笔记(二)
·用Visual C++打造IE浏览器(1)
·每个开发人员现在应该下载的十种必备工具
·教你用VC6做QQ对对碰外挂程序
·Netmsg 局域网聊天程序
·Windows消息大全
·VC++下使用ADO编写数据库程序
·VC++学习笔记(四)
·非法探取密码的原理及其防范
·怎样在VC++中访问、修改注册表

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
XML文件源码察看器(六)

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

        case 9: 'Document 节点 -- 节点。不需要显示,只需显示子节点


                '遍历节点的子节点就是这样写地 : ) ,so easy




                intCount = nodNode.childNodes.length


                if intCount > 0 then


                    for intNode = 0 to intCount-1


                        strNodes =strNodes &  renderChildNodes(nodNode.childNodes(intNode), intLevel + 1)


                    next


                end if


        case else:'普通节点


                


                strNodes=strNodes & getIndent(intLevel)& "<font color=""blue"">&lt</font>" ' 蓝色 <


                strNodes=strNodes & "<font color=""#800000"">"& nodNode.nodeName & "</font> " ' 褐色 node name


                


                '显示 属性


                set nodAttrList = nodNode.attributes'得到属性节点集(collection -- 我最喜欢的数据类型之一)


                intCount = nodAttrList.length 'collection length ,方便吧? :)


                if intCount > 0 then


                    for intAttr = 0 to intCount-1


                    '红色 属性名,蓝色 引号


                    strNodes  =strNodes &  "<font color=""red"">"+nodAttrList(intAttr).nodeName + "</font>=<font color=""blue"">""</font>" & nodAttrList(intAttr).nodeValue & "<font color=""blue"">""</font> "


                    next


                end if




                '处理当前节点的子节点                


                intCount = nodNode.childNodes.length


                if intCount > 0 then'如果有子节点


                    strNodes=strNodes & "<font color=""blue"">&gt</font><br>"  '属性显示完 ,用闭合 Tag


                    


                    ' 对每个子节点递归调用 renderChildNodes


                    for intNode = 0 to intCount-1


                        strNodes = strNodes & renderChildNodes(nodNode.childNodes(intNode), intLevel + 1)


                    next


                    '显示关闭标记  </NodeName>


                    strNodes= strNodes & getIndent(intLevel) & "<font color=""blue"">&lt/</font><font color=""#800000"">"+nodNode.nodeName & "</font><font color=""blue"">&gt</font><br>"


                else


                    strNodes = strNodes & "<font color=""blue"">/&gt</font><br>" '没有子节点, 显示/


                end if                


    end select




    renderChildNodes = strNodes


end function  



'给注释节点着色


function renderComment(nodNode,intLevel)


    dim strNodes,intCount,intNode


    strNodes = ""


    intCount = 0


    intNode = 0


    dim nodAttrList


    strNodes=strNodes & getIndent(intLevel)& "<font color=""gray"">&lt!--  "


    strNodes= strNodes & nodNode.nodeValue


    strNodes=strNodes &"  --&gt</font><br>"


    renderComment = strNodes


end function






相关文章

相关软件