Search code examples
androidxmleclipseadteclipse-adt

Error parsing XML: junk after document element - Building an Icon Pack


I´m currently creating an free Material Design Icon Pack following [this][1] tutorial (I don´t have much experience in coding) in Eclipse. After I added some of my Icons to the applifter.xml and declared them in the iconpack.xml I get this Error when I´m trying to build it:

[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.

It says "the markup in the document following the root document must be well formed"

This is my 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"                            

And the 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>

How can I resolve this?

Thank in advance :-)


Solution

  • XML files have a strictly defined structure which you must follow. In this case everything must be between the

    <resources>
    
      .... everything must be here ....
    
    </resources>
    

    tags. Putting anything after the </resources> will result in the 'not well formed error'. (The <?xml version="1.0" encoding="utf-8"?> is the exception and must be first).

    Also some of your

    <item component="ComponentInfo{com.djit.bassboostforandroidpro/com.djit.bassboost.MainActivity}" drawable="bassbooster"       
    

    values do not end properly. There must be a /> at the end of each item - like this:

    <item component="ComponentInfo{com.djit.bassboostforandroidpro/com.djit.bassboost.MainActivity}" drawable="bassbooster" />