Thanks Klaus, I'm using an each like u said.

I'm looking for something like the second one, but unfortunately this didnt
work.

On 12/15/06, Klaus Hartl <[EMAIL PROTECTED]> wrote:

Pje schrieb:
> Hi,
>
> I need to manipulate a XML that i receive from a request. The XML looks
> like:
>
> <root>
>     <company>
>         <id>3</id>
>         <name>foo</name>
>     </company>
>     <company>
>         <id>5</id>
>         <name>bar</name>
>     </company>
> </root>
>
> There is a way to get the node company that have a specific id?
>
> $('company:nth('5')', xml).text(); will return the 5th node... what i
> need is the node with id 5. Any tips?

Try

var node;
$('company', xml).each(function() {
     var jqId = $('id', this);
     if (jqId.text() == 5) {
         node = jqId[0];
         return false; // break
     }
});


Maybe this works too:

var node = $('company/id[5]').parent();


-- Klaus

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to