0

I am parsing a big xml file (around 50mb) with SAX parser and i'm encountering a problem which i cannot solve with the answer I found on the forum :

parsing huge length string using sax parser in android

My problem is in the "Characters" function.

public void characters(char[] ch, int start, int length)
        throws SAXException { 

        if(mQuery){
             String vQuery = new String(ch,start,length);
              ...
              }

The queries I am parsing can sometimes be really huge (>2500 characters) and I heard that the maximum chunk size that SAX can parse is 1024. This is why my program is hanging when it encounters a huge string.

I tried the workaround given in the previous post (appending the String with a temporary string or using a StringBuilder object) and none of those worked.

I'm not willing to use another xml parser because of performance issues: it's a small program and it's meant to execute fast.

Thanks for your advices.

Community
  • 1
  • 1

0 Answers0