Javascript 读取XML节点属性

                    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;            
                   }

你可能感兴趣的:(Javascript 读取XML节点属性)