解析错误 XML:文档元素后出现垃圾 - 构建图标包
Error parsing XML: junk after document element - Building an Icon Pack
我目前正在按照 [this][1] 教程(我在编码方面没有太多经验)在 Eclipse 中创建一个免费的 Material 设计图标包。在我将一些图标添加到 applifter.xml 并在 iconpack.xml 中声明它们之后,我在尝试构建它时遇到此错误:
[2015-02-26 16:10:35 - Materialism] C:\Users\...\workspace\Materialism\res\values\iconpack.xml:10: error: Error parsing XML: junk after document element
[2015-02-26 16:10:35 - Materialism]
[2015-02-26 16:10:35 - Materialism] C:\Users\...\workspace\Materialism\res\xml\appfilter.xml:12: error: Error parsing XML: junk after document element
[2015-02-26 16:10:35 - Materialism]
[2015-02-26 16:12:30 - Materialism] Error in an XML file: aborting build.
它说 "the markup in the document following the root document must be well formed"
这是我的 applifter.xml:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<iconback img1="iconback" />
<iconmask img1="iconmask" />
<iconupon img1="iconupon" />
<scale factor="1.1" />
<!-- Browser -->
<item component="ComponentInfo{com.android.browser/com.android.browser.BrowserActivity}" drawable="com_android_browser_browseractivity" />
<item component="ComponentInfo{com.google.android.browser/com.android.browser.BrowserActivity}" drawable="com_android_browser_browseractivity" />
</resources>
<item component="ComponentInfo{com.djit.bassboostforandroidpro/com.djit.bassboost.MainActivity}" drawable="bassbooster"
<item component="ComponentInfo{com.devhd.feedly/com.devhd.feedly.Main}" drawable="feedly"
<item component="ComponentInfo{com.rhapsody.napster/com.rhapsodycore.SplashScreen}" drawable="napster"
<item component="ComponentInfo{com.netflix.mediaclient/com.netflix.mediaclient.UIWebViewActivity}" drawable="netflix"
<item component="ComponentInfo{com.android.stk/com.android.stk.StkMenuActivity}" drawable="simtoolkit"
<item component="ComponentInfo{com.snapchat.android/com.snapchat.android.LandingPageActivity}" drawable="snapchat"
<item component="ComponentInfo{com.rarlab.rar/com.rarlab.rar.MainActivity}" drawable="rar"
<item component="ComponentInfo{com.keramidas.TitaniumBackup/com.keramidas.TitaniumBackup.MainActivity}" drawable="titaniumbackup"
和 iconpack.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="icon_pack" translatable="false">
<item>com_android_browser_browseractivity</item>
</string-array>
</resources>
<string-array name="icon_pack" translatable="false">
<item>bassbooster</item>
</string-array>
<string-array name="icon_pack" translatable="false">
<item>feedly</item>
</string-array>
<string-array name="icon_pack" translatable="false">
<item>napster</item>
</string-array>
<string-array name="icon_pack" translatable="false">
<item>netflix</item>
</string-array>
<string-array name="icon_pack" translatable="false">
<item>rar</item>
</string-array>
<string-array name="icon_pack" translatable="false">
<item>simtoolkit</item>
</string-array>
我该如何解决?
提前致谢:-)
XML 文件具有您必须遵循的严格定义的结构。在这种情况下,一切都必须在
之间
<resources>
.... everything must be here ....
</resources>
标签。在 </resources>
之后放置任何内容都会导致 'not well formed error'。 (<?xml version="1.0" encoding="utf-8"?>
是例外,必须排在第一位)。
还有你的一些
<item component="ComponentInfo{com.djit.bassboostforandroidpro/com.djit.bassboost.MainActivity}" drawable="bassbooster"
值未正确结束。每个项目的末尾必须有一个 />
- 像这样:
<item component="ComponentInfo{com.djit.bassboostforandroidpro/com.djit.bassboost.MainActivity}" drawable="bassbooster" />
我目前正在按照 [this][1] 教程(我在编码方面没有太多经验)在 Eclipse 中创建一个免费的 Material 设计图标包。在我将一些图标添加到 applifter.xml 并在 iconpack.xml 中声明它们之后,我在尝试构建它时遇到此错误:
[2015-02-26 16:10:35 - Materialism] C:\Users\...\workspace\Materialism\res\values\iconpack.xml:10: error: Error parsing XML: junk after document element
[2015-02-26 16:10:35 - Materialism]
[2015-02-26 16:10:35 - Materialism] C:\Users\...\workspace\Materialism\res\xml\appfilter.xml:12: error: Error parsing XML: junk after document element
[2015-02-26 16:10:35 - Materialism]
[2015-02-26 16:12:30 - Materialism] Error in an XML file: aborting build.
它说 "the markup in the document following the root document must be well formed"
这是我的 applifter.xml:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<iconback img1="iconback" />
<iconmask img1="iconmask" />
<iconupon img1="iconupon" />
<scale factor="1.1" />
<!-- Browser -->
<item component="ComponentInfo{com.android.browser/com.android.browser.BrowserActivity}" drawable="com_android_browser_browseractivity" />
<item component="ComponentInfo{com.google.android.browser/com.android.browser.BrowserActivity}" drawable="com_android_browser_browseractivity" />
</resources>
<item component="ComponentInfo{com.djit.bassboostforandroidpro/com.djit.bassboost.MainActivity}" drawable="bassbooster"
<item component="ComponentInfo{com.devhd.feedly/com.devhd.feedly.Main}" drawable="feedly"
<item component="ComponentInfo{com.rhapsody.napster/com.rhapsodycore.SplashScreen}" drawable="napster"
<item component="ComponentInfo{com.netflix.mediaclient/com.netflix.mediaclient.UIWebViewActivity}" drawable="netflix"
<item component="ComponentInfo{com.android.stk/com.android.stk.StkMenuActivity}" drawable="simtoolkit"
<item component="ComponentInfo{com.snapchat.android/com.snapchat.android.LandingPageActivity}" drawable="snapchat"
<item component="ComponentInfo{com.rarlab.rar/com.rarlab.rar.MainActivity}" drawable="rar"
<item component="ComponentInfo{com.keramidas.TitaniumBackup/com.keramidas.TitaniumBackup.MainActivity}" drawable="titaniumbackup"
和 iconpack.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="icon_pack" translatable="false">
<item>com_android_browser_browseractivity</item>
</string-array>
</resources>
<string-array name="icon_pack" translatable="false">
<item>bassbooster</item>
</string-array>
<string-array name="icon_pack" translatable="false">
<item>feedly</item>
</string-array>
<string-array name="icon_pack" translatable="false">
<item>napster</item>
</string-array>
<string-array name="icon_pack" translatable="false">
<item>netflix</item>
</string-array>
<string-array name="icon_pack" translatable="false">
<item>rar</item>
</string-array>
<string-array name="icon_pack" translatable="false">
<item>simtoolkit</item>
</string-array>
我该如何解决?
提前致谢:-)
XML 文件具有您必须遵循的严格定义的结构。在这种情况下,一切都必须在
之间<resources>
.... everything must be here ....
</resources>
标签。在 </resources>
之后放置任何内容都会导致 'not well formed error'。 (<?xml version="1.0" encoding="utf-8"?>
是例外,必须排在第一位)。
还有你的一些
<item component="ComponentInfo{com.djit.bassboostforandroidpro/com.djit.bassboost.MainActivity}" drawable="bassbooster"
值未正确结束。每个项目的末尾必须有一个 />
- 像这样:
<item component="ComponentInfo{com.djit.bassboostforandroidpro/com.djit.bassboost.MainActivity}" drawable="bassbooster" />