Note that there are some explanatory texts on larger screens.

plurals
  1. POParsing large XML files in Android
    primarykey
    data
    text
    <p>I am trying to parse a rather large XML file - 1MB+, but I am having some difficulties. I first tried to add the xml file to the res/xml and parse it with the XmlResourceParser, but I got an exception saying "Data exceeds UNCOMPRESS_DATA_MAX". After a bit of research I found out that the compressed files have to be uncompressed in memory before reading and that this restriction doesnt apply for raw files. However when trying to parse the xml file from the res/raw folder with the SAXParser, I get an IOException, without any message and stacktrace:</p> <pre><code>SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); xr.setContentHandler(myXMLHandler); InputSource src = new InputSource(stream); xr.parse(src); // IOException </code></pre> <p>From what I understand those memory restrictions do not apply to raw resources, but what is causing this exception then?</p> <p>Here is the stacktrace from logcat:</p> <pre><code>11-11 23:47:50.729: WARN/System.err(4886): java.io.IOException 11-11 23:47:50.739: WARN/System.err(4886): at android.content.res.AssetManager.readAsset(Native Method) 11-11 23:47:50.749: WARN/System.err(4886): at android.content.res.AssetManager.access$800(AssetManager.java:36) 11-11 23:47:50.759: WARN/System.err(4886): at android.content.res.AssetManager$AssetInputStream.read(AssetManager.java:542) 11-11 23:47:50.759: WARN/System.err(4886): at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:504) 11-11 23:47:50.769: WARN/System.err(4886): at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:467) 11-11 23:47:50.779: WARN/System.err(4886): at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:329) 11-11 23:47:50.790: WARN/System.err(4886): at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:286) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload