//一定要用索引,而且删除的对象要是XMLList里面的元素,不然会报错,或者不能删除  
                private function delNoVisibleNode(xmllist:XMLList):void  
                {  
                    //for each (var item:XML in xmllist)  
                    for (var i:int=xmllist.length() - 1; i >= 0; i--)  
                    {  
                        var item:XML=xmllist[i];  
                        if (item.@visible.toString() == "false" && item != null)  
                        {  
                            delete xmllist[item.childIndex()];  
                            menuByVisibleFlaseXML.appendChild(item);  
                            //删除符合条件的子节点: delete xml.children()(@type ==  “car” && @color == “red”);   
                        }  
                        else if (item.@visible.toString() == "true")  
                        {  
                            if (item.hasComplexContent()) //有子节点  
                            {  
                                arguments.callee(item.children());  
                                //delNoVisibleNode(item.children());  
                            }  
                        }  
                    }  
                }  

 

相关文章:

  • 2021-09-30
  • 2022-01-04
  • 2021-12-22
  • 2021-11-02
  • 2022-12-23
  • 2021-06-07
  • 2021-05-21
  • 2022-12-23
猜你喜欢
  • 2021-09-06
  • 2022-01-20
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
  • 2021-12-07
相关资源
相似解决方案