• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

XML Parsing Problem.

 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am fetching a data from an XML. XML has few data and images encoded in base 64. Now problem is base 64 is having very large text.And somehow it is fetching a few part of data.
e.g. if data is of length of 3000 lines it reads 1000 or 2000 lines only.

I can not figure out the problem.Because it is not in my control. Parsers are provided by Java only.
I am using SAX parcer.

Following is small amount of code which I have written.




Now that characters method is not getting whole data in array.

Please help me out.
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The characters method is not guaranteed to receive all of a text string in one go. It may be called multiple times for a single piece of text - which is what is happening here. Instead of trying to process the text in the characters method, you should just buffer it (in a StringBuilder maybe) and then process the contents of the buffer the next time the endElement method is called.
 
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does this have to do with Android?
 
Hardik Trivedi
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Changed the parser and solve the problem. Thanks all.
 
Beauty is in the eye of the tiny ad.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic