plist simpleXML, trouble accessing array list



Lets say I have a plist simplexml document that looks like this:



<dict>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>


I can access a string like so:



$obj->dict->string[0]


This will return 6.0 for me. However if I want to access the first string in the second array:



$obj->dict->array[1]->string[0]


PHP throws an error and doesn't like my reference to array. What's the proper syntax here? Not a whole lot of examples on apple plist simplexml documents out there. Thanks.


No comments:

Post a Comment