Cannot parse Android Manifest XML
tfKamran opened this issue · comments
Tried parsing the following XML:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.vending" platformBuildVersionCode="26" platformBuildVersionName="8.0.0">
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-feature android:glEsVersion="0x00020000"/>
<application android:allowBackup="true" android:alwaysRetainTaskState="true" android:anyDensity="true" android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:largeHeap="true" android:launchMode="singleInstance" android:name="com.android.vending.LiveApplication" android:normalScreens="true" android:persistent="false" android:screenOrientation="portrait" android:supportsRtl="true" android:theme="@style/AppTheme">
<meta-data android:name="APPKEY" android:value="10505945"/>
<receiver android:exported="true" android:name="com.google.android.gms.gcm.GcmReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<category android:name="gcm.play.android.samples.com.gcmquickstart"/>
</intent-filter>
</receiver>
<service android:exported="false" android:name="com.gcm.MyGcmListenerService">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
</intent-filter>
</service>
<service android:exported="false" android:name="com.gcm.MyInstanceIDListenerService">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
<activity android:configChanges="keyboardHidden|orientation|screenSize" android:exported="false" android:launchMode="singleTop" android:name="com.linecorp.linesdk.auth.internal.LineAuthenticationActivity" android:theme="@style/LineSdk_AuthenticationActivity"/>
<activity android:configChanges="keyboardHidden|orientation|screenSize" android:exported="true" android:name="com.android.vending.MainActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="lineauth"/>
</intent-filter>
</activity>
</application>
</manifest>
Got this error:
node_modules/xmltojson/lib/xmlToJSON.js:74
if (options.xmlns && oXMLParent.namespaceURI) {
^TypeError: Cannot read property 'namespaceURI' of null
at Object.xmlToJSON.parseXML (node_modules/xmltojson/lib/xmlToJSON.js:74:41)
at Object.xmlToJSON.parseString (node_modules/xmltojson/lib/xmlToJSON.js:59:21)
Am I doing something wrong?
Getting the same error when I try to parse your own example:
testString = '<xml><a>It Works!</a></xml>';
result = xmlToJSON.parseString(testString);
+1
I suspect that you are using this library from NodeJS. The README notes that this lib is intended for browser use only and that Node is not supported. However, there is a suggestion in the README for a workaround.
When running in a proper browser environment, I received the following results
{
"manifest": [{
"_attr": {
"xmlns:android": {
"_value": "http://schemas.android.com/apk/res/android",
"_ns": "http://www.w3.org/2000/xmlns/"
},
"package": {
"_value": "com.android.vending"
},
"platformBuildVersionCode": {
"_value": 26
},
"platformBuildVersionName": {
"_value": "8.0.0"
}
},
"uses-permission": [{
"_attr": {
"name": {
"_value": "com.google.android.c2dm.permission.RECEIVE",
"_ns": "http://schemas.android.com/apk/res/android"
}
},
"_text": [null]
}],
"uses-feature": [{
"_attr": {
"glEsVersion": {
"_value": 0,
"_ns": "http://schemas.android.com/apk/res/android"
}
},
"_text": [null]
}],
"application": [{
"_attr": {
"allowBackup": {
"_value": true,
"_ns": "http://schemas.android.com/apk/res/android"
},
"alwaysRetainTaskState": {
"_value": true,
"_ns": "http://schemas.android.com/apk/res/android"
},
"anyDensity": {
"_value": true,
"_ns": "http://schemas.android.com/apk/res/android"
},
"hardwareAccelerated": {
"_value": true,
"_ns": "http://schemas.android.com/apk/res/android"
},
"icon": {
"_value": "@mipmap/icon",
"_ns": "http://schemas.android.com/apk/res/android"
},
"label": {
"_value": "@string/app_name",
"_ns": "http://schemas.android.com/apk/res/android"
},
"largeHeap": {
"_value": true,
"_ns": "http://schemas.android.com/apk/res/android"
},
"launchMode": {
"_value": "singleInstance",
"_ns": "http://schemas.android.com/apk/res/android"
},
"name": {
"_value": "com.android.vending.LiveApplication",
"_ns": "http://schemas.android.com/apk/res/android"
},
"normalScreens": {
"_value": true,
"_ns": "http://schemas.android.com/apk/res/android"
},
"persistent": {
"_value": false,
"_ns": "http://schemas.android.com/apk/res/android"
},
"screenOrientation": {
"_value": "portrait",
"_ns": "http://schemas.android.com/apk/res/android"
},
"supportsRtl": {
"_value": true,
"_ns": "http://schemas.android.com/apk/res/android"
},
"theme": {
"_value": "@style/AppTheme",
"_ns": "http://schemas.android.com/apk/res/android"
}
},
"meta-data": [{
"_attr": {
"name": {
"_value": "APPKEY",
"_ns": "http://schemas.android.com/apk/res/android"
},
"value": {
"_value": 10505945,
"_ns": "http://schemas.android.com/apk/res/android"
}
},
"_text": [null]
}],
"receiver": [{
"_attr": {
"exported": {
"_value": true,
"_ns": "http://schemas.android.com/apk/res/android"
},
"name": {
"_value": "com.google.android.gms.gcm.GcmReceiver",
"_ns": "http://schemas.android.com/apk/res/android"
},
"permission": {
"_value": "com.google.android.c2dm.permission.SEND",
"_ns": "http://schemas.android.com/apk/res/android"
}
},
"intent-filter": [{
"action": [{
"_attr": {
"name": {
"_value": "com.google.android.c2dm.intent.RECEIVE",
"_ns": "http://schemas.android.com/apk/res/android"
}
},
"_text": [null]
}],
"category": [{
"_attr": {
"name": {
"_value": "gcm.play.android.samples.com.gcmquickstart",
"_ns": "http://schemas.android.com/apk/res/android"
}
},
"_text": [null]
}]
}]
}],
"service": [{
"_attr": {
"exported": {
"_value": false,
"_ns": "http://schemas.android.com/apk/res/android"
},
"name": {
"_value": "com.gcm.MyGcmListenerService",
"_ns": "http://schemas.android.com/apk/res/android"
}
},
"intent-filter": [{
"action": [{
"_attr": {
"name": {
"_value": "com.google.android.c2dm.intent.RECEIVE",
"_ns": "http://schemas.android.com/apk/res/android"
}
},
"_text": [null]
}]
}]
}, {
"_attr": {
"exported": {
"_value": false,
"_ns": "http://schemas.android.com/apk/res/android"
},
"name": {
"_value": "com.gcm.MyInstanceIDListenerService",
"_ns": "http://schemas.android.com/apk/res/android"
}
},
"intent-filter": [{
"action": [{
"_attr": {
"name": {
"_value": "com.google.android.gms.iid.InstanceID",
"_ns": "http://schemas.android.com/apk/res/android"
}
},
"_text": [null]
}]
}]
}],
"activity": [{
"_attr": {
"configChanges": {
"_value": "keyboardHidden|orientation|screenSize",
"_ns": "http://schemas.android.com/apk/res/android"
},
"exported": {
"_value": false,
"_ns": "http://schemas.android.com/apk/res/android"
},
"launchMode": {
"_value": "singleTop",
"_ns": "http://schemas.android.com/apk/res/android"
},
"name": {
"_value": "com.linecorp.linesdk.auth.internal.LineAuthenticationActivity",
"_ns": "http://schemas.android.com/apk/res/android"
},
"theme": {
"_value": "@style/LineSdk_AuthenticationActivity",
"_ns": "http://schemas.android.com/apk/res/android"
}
},
"_text": [null]
}, {
"_attr": {
"configChanges": {
"_value": "keyboardHidden|orientation|screenSize",
"_ns": "http://schemas.android.com/apk/res/android"
},
"exported": {
"_value": true,
"_ns": "http://schemas.android.com/apk/res/android"
},
"name": {
"_value": "com.android.vending.MainActivity",
"_ns": "http://schemas.android.com/apk/res/android"
}
},
"intent-filter": [{
"action": [{
"_attr": {
"name": {
"_value": "android.intent.action.VIEW",
"_ns": "http://schemas.android.com/apk/res/android"
}
},
"_text": [null]
}],
"category": [{
"_attr": {
"name": {
"_value": "android.intent.category.DEFAULT",
"_ns": "http://schemas.android.com/apk/res/android"
}
},
"_text": [null]
}, {
"_attr": {
"name": {
"_value": "android.intent.category.BROWSABLE",
"_ns": "http://schemas.android.com/apk/res/android"
}
},
"_text": [null]
}],
"data": [{
"_attr": {
"scheme": {
"_value": "lineauth",
"_ns": "http://schemas.android.com/apk/res/android"
}
},
"_text": [null]
}]
}]
}]
}]
}]
}
Ok, closing this issue.