I’m having trouble extracting attributes from the following XML using SimpleXML functions. I’m trying to get android:versionName, minSdkVersion, normalScreens and largeScreens.
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="20"
android:versionName="1.0.0.5"
package="com.s.android.lite"
>
<uses-sdk
android:minSdkVersion="1"
>
</uses-sdk>
<supports-screens
android:anyDensity="true"
android:normalScreens="true"
android:largeScreens="true"
>
</supports-screens>
<application
android:label="@7F080001"
android:icon="@7F020056"
android:name=".SApplication"
android:persistent="false"
android:debuggable="false"
>
<activity
android:name=".SActivity"
>
<intent-filter
>
<action
android:name="android.intent.action.MAIN"
>
</action>
<category
android:name="android.intent.category.LAUNCHER"
>
</category>
</intent-filter>
</activity>
<activity
android:name=".Signin"
>
</activity>
<activity
android:name=".ChatScreen"
>
</activity>
<activity
android:name=".ContactList"
>
<intent-filter
<action
android:name="android.intent.action.CREATE_LIVE_FOLDER"
>
</action>
<category
android:name="android.intent.category.DEFAULT"
>
</category>
</intent-filter>
</activity>
</application>
<uses-permission
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="android.permission.INTERNET"
>
</uses-permission>
<uses-permission
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="android.permission.READ_CONTACTS"
>
</uses-permission>
</manifest>
I’ve tried various things with xpath() which haven’t worked, for example…
$mfxml = simplexml_load_file('manifest.xml');
$mfxml->registerXPathNamespace('default', 'http://schemas.android.com/apk/res/android');
$result = $mfxml->xpath('//default:manifest/supports-screens/@anyDensity');
var_dump($result);
Any help would be appreciated.
Thanks