S.l.e!ep.¢%

像打了激速一样,以四倍的速度运转,开心的工作
简单、开放、平等的公司文化;尊重个性、自由与个人价值;
posts - 1098, comments - 335, trackbacks - 0, articles - 1
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

Javascript 读取XML节点属性

Posted on 2009-09-18 11:55 S.l.e!ep.¢% 阅读(456) 评论(0)  编辑 收藏 引用 所属分类: HTML

                    var objXMLDoc = new ActiveXObject("MSXML.DOMDocument"); 
                    objXMLDoc.async = false;

                    if( objXMLDoc.loadXML(strXml) )
                    {
                        Nodes = null;
                        Nodes = objXMLDoc.selectNodes("test/test1/test1");
                        nLength = Nodes.length;

                        if( nLength <= 0 )  
                            return;       

                        Attributes = null;
                        Attributes = Nodes(0).attributes;
                        nLength = Attributes.length;

                        if( nLength <= 0 )     
                            return;     

                        var attribute = Attributes.getNamedItem("1111");
                        if( attribute == null ) 
                            return;        

                        if( attribute.value != "11111" )
                            return;            
                   }


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理