【发布时间】:2015-11-20 05:17:22
【问题描述】:
我正在使用 dom4j 来解析 AndroidManifestFile.xml。但是我发现它奇怪地对待“android:xxx”属性。
例如:
<receiver android:name="ProcessOutgoingCallTest" android:exported="false"
android:enabled="false">
<intent-filter android:priority="1">
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
返回值e.attributeValue("android:exported") 将是null 但是使用e.attributeValue("exported") 将获得正确的字符串(但我不喜欢这种方式,因为它可能会比预期匹配更多)。同时,e.attributeValue(new QName("android:exported")) 仍然是一个空字符串。
获取属性的正确方法是什么
【问题讨论】: