*
The moose likes Android and the fly likes XML Parsing Problem. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "XML Parsing Problem." Watch "XML Parsing Problem." New topic
Author

XML Parsing Problem.

Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
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.
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3432
    
  12
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.


Joanne
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41173
    
  45
What does this have to do with Android?


Ping & DNS - my free Android networking tools app
Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
Changed the parser and solve the problem. Thanks all.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML Parsing Problem.
 
Similar Threads
How to stop parsing of a file with SAX
Loading XML Files into Android App
Missing characters with SAX Parser
parsing XML data from weather RSS
How to parse 100mb xml file