This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Android and the fly likes SAX  problem only in android 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 "SAX  problem only in android" Watch "SAX  problem only in android" New topic
Author

SAX problem only in android

Alessandro Camel
Ranch Hand

Joined: Jul 03, 2009
Posts: 35
I have read about the problem in the SAX parser (sometimes it can return only chunck of data: it's up to the developer to handle this).
I'd like to understand why my class acts very well when I use it in the command line but it truncate the text if I use it into android.
Of course the data are the same in both cases.

Does it depends to the virtual machine?

Thanks


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41182
    
  45
Not all SAX implementations work exactly the same, which is fine as long as they conform to the SAX javadocs. It sounds as if you're hitting the problem described at the top of the XmlFaq; see that page for more details.


Ping & DNS - my free Android networking tools app
Alessandro Camel
Ranch Hand

Joined: Jul 03, 2009
Posts: 35
Ulf Dittmer wrote:Not all SAX implementations work exactly the same, which is fine as long as they conform to the SAX javadocs. It sounds as if you're hitting the problem described at the top of the XmlFaq; see that page for more details.


Thanks Ulf, indeed I had that problem and I bumped into a lot of posts about it!
I resolved it quite soon, but I was surprise to see different behaviors between "linux command line" and "android emulator" (please forgive me for these terms! )

I am following "Head First Android delevopment" book and I spent about 10 hours to fix the first "ready bake code"!!

It's quite fun: good exercize for my brain and for my (very little) java skills too!!!
zoheb hassan
Ranch Hand

Joined: Apr 01, 2009
Posts: 150

Hey Alessandro is the book out i.e.Head First Android development??
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41182
    
  45
Google would know that much faster than anyone here could possibly answer, no?
Alessandro Camel
Ranch Hand

Joined: Jul 03, 2009
Posts: 35
zoheb hassan wrote:Hey Alessandro is the book out i.e.Head First Android development??


It's an "early release" that I have bought from O'Reilly in pdf format.
It is not complete and there are different mistakes, but as "Head First Java" I'm enjoying it! ;)
jonathan simon
Greenhorn

Joined: Sep 01, 2011
Posts: 4
Alessandro Camel wrote:
I am following "Head First Android delevopment" book and I spent about 10 hours to fix the first "ready bake code"!!

It's quite fun: good exercize for my brain and for my (very little) java skills too!!!


Hi Alessandro.

I'm the author of Head First Android Development and I'm cranking away trying to get the last few chapters finished off. I'm really sorry that the ready baked code from the NASA Image of the day app is broken! Those were some of the first chapters I wrote and I had an inordinate number of copy/paste mistakes that I'm working hard to fix now. If you find issues as you work through the book, it would be great if you could add errata (there is a place for errata on the book page at O'Reilly http://oreilly.com/catalog/0636920012825).

That said, if you (or anyone else) has any suggestions about a better or more generic way to implement the SAX parsing, drop me a line here or at jonathan.s.simon@gmail.com. I'm also in the process of getting the code example apps for book packaged up for distribution which would make your problems a lot less hard to solve. I'm leaning towards github to make it easy for learners to fork the examples, but we'll have to see how O'Reilly wants to distribute the code ;)

I hope you're enjoying the book Alessandro! Love to hear what you think!

Thanks!
Jonathan
Alessandro Camel
Ranch Hand

Joined: Jul 03, 2009
Posts: 35
jonathan simon wrote:

Hi Alessandro.

I'm the author of Head First Android Development and I'm cranking away trying to get the last few chapters finished off. I'm really sorry that the ready baked code from the NASA Image of the day app is broken! Those were some of the first chapters I wrote and I had an inordinate number of copy/paste mistakes that I'm working hard to fix now. If you find issues as you work through the book, it would be great if you could add errata (there is a place for errata on the book page at O'Reilly http://oreilly.com/catalog/0636920012825).

That said, if you (or anyone else) has any suggestions about a better or more generic way to implement the SAX parsing, drop me a line here or at jonathan.s.simon@gmail.com. I'm also in the process of getting the code example apps for book packaged up for distribution which would make your problems a lot less hard to solve. I'm leaning towards github to make it easy for learners to fork the examples, but we'll have to see how O'Reilly wants to distribute the code ;)

I hope you're enjoying the book Alessandro! Love to hear what you think!

Thanks!
Jonathan


Thanks Jonathan,
as I said, I really like the book and I am going to send you an email with my impressions and I am going to submit the errata I found on it!

With this I'd like to thank you, pubblicaly, for your work !
I am really enjoying the book, but more than that, it really gave me the possibility to put my hands on android programming without been boring from hundreds of theorical stuff.
(and I mean put my hand on java code, not only XML code as a lot of beginners books are doing).

I feel to say anyone:" hey, this book is great for starting: buy it, but you have to clean your dust for your old java books, and put beside it another "not funny" android book"! ;)

Best regards
Alessandro
jonathan simon
Greenhorn

Joined: Sep 01, 2011
Posts: 4
Quick follow-up:

I posted the sample code for the book on GitHub: https://github.com/jonathansimon/HFAD-Code-Samples. Right now, I added the sample code for chapters 1-4. I'm working revisions of chapters 6-8, so I'm holding off up putting that code up there.

I tracked down the issues with the NASA app and it actually looks like in addition to the issues mentioned here, they updated the feed changing the location of the image to be inside a link/enclosure element. It should be all working now.

If you see any other issues, or have suggestions on improving the code, drop me a line. Thanks!
 
 
subject: SAX problem only in android
 
Similar Threads
Reading from XML file
How to parse 100mb xml file
DOM4j , JDOM, DOM and Sax Performance
Retrieve values for a complicate XML file (Java)
SAX parser problem