iPhone: Get value in multi-dimentional array

Posted by Nic Hubbard on Stack Overflow See other posts from Stack Overflow or by Nic Hubbard
Published on 2010-12-24T20:44:21Z Indexed on 2010/12/24 21:54 UTC
Read the original article Hit count: 180

Filed under:
|
|

I have an array that is many levels deep and I am wondering what is the best way to get one of the child element values that is deep in my array.

I assume I need to use a recursive method, but what is the best way to do this? Or is there a faster way to do this?

The array comes from an XML Parser that I am using which builds everything into an array like this (using NSLog to show the structure):

{
        children =         (
                        {
                children =                 (
                                        {
                        children =                         (
                                                        {
                                children =                                 (
                                );
                                data = 12;
                                element = AssetID;
                            }
                        );
                        data = "";
                        element = "ns1:GetUserIdByUsernameResponse";
                    }
                );
                data = "";
                element = "SOAP-ENV:Body";
            }
        );
        data = "";
        element = "SOAP-ENV:Envelope";
    }

What I would like to get at is the AssetID data, which in this case is 12.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c