hi zero,

try this...

 var compenonts= $('Components > Component', response);



--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 12, 2008, at 10:30 AM, zero args wrote:

my code:
$.ajax({
  url: "test.do",
  dataType: "xml",
  success:paint
});
var paint = function(response){
var compenonts= $(response).find("Component"); // what expression should be here??
  compenonts.each(function(index, compenont_ele){
      var compenont = $(compenont_ele);
      var name= compenont.attr("name");
      alert(name);
   });
}
I expect alert : a、b、c、d
but actually alert : a、b、c、c1、c2、d



test.do wil return :
<Components>
       <Component name="a" />
       <Component name="b" />
       <Component name="c" >
               <children name="c.children" >
                    <Component name="c1" >
                    <Component name="c2" >
                     ...
               </children>
       </Component>
       <Component name="d" />
</Components>


Reply via email to