Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
28 replies Latest Post - ‏2013-01-16T00:37:14Z by SystemAdmin
SystemAdmin
SystemAdmin
13339 Posts
ACCEPTED ANSWER

Pinned topic 398121

‏2009-12-13T12:07:25Z |
http://www.ibm.com/developerworks/xml/library/x-android/

Edited by: dweditor_admin on Jan 7, 2010 2:56 PM

Edited by: dweditor_admin on Mar 23, 2010 8:49 PM
Updated on 2013-01-16T00:37:14Z at 2013-01-16T00:37:14Z by SystemAdmin
  • cocb2
    cocb2
    1 Post
    ACCEPTED ANSWER

    test

    ‏2009-12-13T12:07:26Z  in response to SystemAdmin
    How does this app know which url to retrieve the xml from? I cannot see that configured anywhere.
  • michael_galpin
    michael_galpin
    7 Posts
    ACCEPTED ANSWER

    test

    ‏2010-01-07T21:10:25Z  in response to SystemAdmin
    It is in the FeedParserFactory class:

    static String feedUrl = "http://www.androidster.com/android_news.rss";
  • subtronic
    subtronic
    1 Post
    ACCEPTED ANSWER

    test

    ‏2010-01-19T17:39:06Z  in response to SystemAdmin
    I'm using the AndroidSaxFeedParser but I get the same result in each row in the returned list. Why is this?
  • PedramKazemi
    PedramKazemi
    1 Post
    ACCEPTED ANSWER

    test

    ‏2010-04-02T16:13:45Z  in response to SystemAdmin
    Thank you Michael for a great article. I am developing an Android application where I need to optimize XML parsing to the max, and I came across your article and code sample.

    At the time of my writing, the latest Android API doc for version 2.1 STILL has the following note in the javadoc in regards to Android's StAX parser:

    public static XmlPullParser newPullParser ()
    Since: API Level 1

    Creates a new pull parser with namespace support.

    Note: This is actually slower than the SAX parser, and it's not fully implemented. If you need a fast, mostly implemented pull parser, use this. If you need a complete implementation, use KXML.

    Source:
    http://developer.android.com/reference/android/util/Xml.html
  • fbesoain
    fbesoain
    1 Post
    ACCEPTED ANSWER

    test

    ‏2010-06-03T05:24:14Z  in response to SystemAdmin
    Thank you so much Michael, this article its outstanding!!!, I am developing an Android application for reading some RSS and play some video, this article help me a lot!

    can I use some chuck of code in my app? I did not see any license in your code, such GPL or something, please let me know.

    thank a lot I really enjoyed studing your article.

    best
  • JLund
    JLund
    1 Post
    ACCEPTED ANSWER

    test

    ‏2010-07-28T23:41:45Z  in response to SystemAdmin
    When I ran through the code I got a huge link with text from CDATA sections before the first ITEM tag. This cause invalid URL in the link tag. I fixed it by adding the following check to the characters() method in RssHandler (since we're only interested to append to builder for CDATA inside an ITEM):

    if (this.currentMessage!=null)
    builder.append(ch, start, length);
  • Riffer
    Riffer
    1 Post
    ACCEPTED ANSWER

    test

    ‏2010-08-09T20:58:53Z  in response to SystemAdmin
    Hello! I just tried your source at higher platforms then 1.5 an run into a total crash of the app.

    Are there any hints I have to follow?
  • anruiz55
    anruiz55
    2 Posts
    ACCEPTED ANSWER

    test

    ‏2010-09-03T09:45:09Z  in response to SystemAdmin
    Hi Michael!

    First thanks you, i never have worked with XML and i have to do a RSS app for Android. Your article have helped me a lot.

    I am having a problem with some of the XMLs i am parsing. Some times the DOM parser i am using generates the error "attr value delimiter missing!" and it stop parsing. I dont use any schema or valitador.

    Which would be the easiest way to ignore/solve this error and continue parsing? Thanks you in advance

    Antonio
  • anruiz55
    anruiz55
    2 Posts
    ACCEPTED ANSWER

    test

    ‏2010-09-03T09:46:03Z  in response to SystemAdmin
    Hi Michael!

    First thanks you, i never have worked with XML and i have to do a RSS app for Android. Your article have helped me a lot.

    I am having a problem with some of the XMLs i am parsing. Some times the DOM parser i am using generates the error "attr value delimiter missing!" and it stop parsing. I dont use any schema or valitador.

    Which would be the easiest way to ignore/solve this error and continue parsing? Thanks you in advance

    Antonio
  • SystemAdmin
    SystemAdmin
    13339 Posts
    ACCEPTED ANSWER

    test

    ‏2010-11-04T13:06:39Z  in response to SystemAdmin
    Where is the copy method used in Listing 8 defined?
  • sirishagurram
    sirishagurram
    1 Post
    ACCEPTED ANSWER

    test

    ‏2010-12-28T10:45:18Z  in response to SystemAdmin
    where is the sample xml feed in the AndroidXML project.
  • PramodTale
    PramodTale
    1 Post
    ACCEPTED ANSWER

    test

    ‏2011-01-08T05:04:00Z  in response to SystemAdmin
    Thanks Michael for this simple and use full article.
  • SystemAdmin
    SystemAdmin
    13339 Posts
    ACCEPTED ANSWER

    test

    ‏2011-01-10T06:46:12Z  in response to SystemAdmin
    how about parse XML with namespaces?
  • jkwest
    jkwest
    1 Post
    ACCEPTED ANSWER

    test

    ‏2011-03-13T00:45:49Z  in response to SystemAdmin
    I can't seem to get it to work with any other feed? I'm trying a feed from feed burner and it crashes as soon as I click button. Thank you for any help you may be able to give.
  • diegodroid
    diegodroid
    1 Post
    ACCEPTED ANSWER

    test

    ‏2011-03-23T14:04:24Z  in response to SystemAdmin
    Hi,
    Greats Works...

    I Have a question,
    How i do to open onListItemClick on my app, without to send for browser

    code:
    protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    Intent viewMessage = new Intent(Intent.ACTION_VIEW,
    Uri.parse(messages.get(position).getLink().toExternalForm()));
    this.startActivity(viewMessage);
    }
  • sanju25april
    sanju25april
    2 Posts
    ACCEPTED ANSWER

    test

    ‏2011-05-24T09:03:58Z  in response to SystemAdmin
    i thanks for the code it helped me a lot.
    i have a question. how i open description on click on title?
  • sanju25april
    sanju25april
    2 Posts
    ACCEPTED ANSWER

    test

    ‏2011-05-24T12:07:41Z  in response to SystemAdmin
    hi thanks for the code it helped me a lot.
    i want to take print out of description when i click on a particular title. Please help me.
    thanks in advance.
  • SystemAdmin
    SystemAdmin
    13339 Posts
    ACCEPTED ANSWER

    test

    ‏2011-06-02T15:36:13Z  in response to SystemAdmin
    I just wanna ask, in Simplified Android SAX, how do I parse a local file.
    Thanks, its a great tutorial.
  • Mostafiz
    Mostafiz
    1 Post
    ACCEPTED ANSWER

    test

    ‏2011-08-14T02:27:59Z  in response to SystemAdmin
    This is great tutorial of XML parsing I have ever seen.It clears my conception.This is the article I have searching.Thanks the author for this great tutorial
  • mnemy
    mnemy
    2 Posts
    ACCEPTED ANSWER

    test

    ‏2011-08-15T11:01:22Z  in response to SystemAdmin
    Thanks for the tutorial. Have there been any more developments in Android XML handling since you wrote this 2 years ago? I'm used to XML Beans which isn't compatible with Android. It'd probably be too slow and resource heavy to work on mobile devices anyway. Are there any other options than basic SAX/DOM parsing available to Android developers?

    Also, your summary seems to indicate that the SAX parser is more powerful than the Pull parser, since you say it's the "safe" pick. Is this an accurate interpretation?

    The Pull parser seems easier to work with to me, but if it's going to run slower than the SAX parser, then I'll have to go with the SAX parser. I don't foresee the need for partial parsing at this time.
  • mnemy
    mnemy
    2 Posts
    ACCEPTED ANSWER

    test

    ‏2011-08-15T11:31:52Z  in response to SystemAdmin
    Hmm, looks like SAX does perform better than XML Pull: http://www.developer.com/ws/article.php/10927_3824221_2/Android-XML-Parser-Performance.htm

    It looks like performance is abysmal regardless of which tool is used though. That's worrisome.
  • zarose
    zarose
    1 Post
    ACCEPTED ANSWER

    test

    ‏2011-09-26T15:21:48Z  in response to SystemAdmin
    I'm trying to implement the Android Sax Parser. It isn't working with my feed. Through debugging it, I have found that throws a Runtime Exception at the end when it tries the following:

    Xml.parse(this.getInputStream(), Xml.Encoding.UTF_8, root.getContentHandler());

    Do I need to reformat the feed itself? Or can I circumvent this try catch?
  • antonio081014
    antonio081014
    1 Post
    ACCEPTED ANSWER

    test

    ‏2011-10-13T01:27:42Z  in response to SystemAdmin
    Nice work, which helped my work become easier for me.
  • TanujLala
    TanujLala
    1 Post
    ACCEPTED ANSWER

    test

    ‏2011-11-09T09:26:42Z  in response to SystemAdmin
    This is awesome !! Its help me lot in completing my project and following link also helped me lot.
    http://mindstick.com/Articles/b14ad2c6-2521-41c5-bb17-f98a872ee127/?Creating%20an%20Android%20Application%20by%20using%20XML%20Layout

    Thanks Everyone!!
  • hpluslabels
    hpluslabels
    1 Post
    ACCEPTED ANSWER

    test

    ‏2011-11-29T13:12:24Z  in response to SystemAdmin
    Hi, all. i am a student , and badly interest to learn about webservice. i wanna ask bout something like lyrics viewer applications. of course there are so many apps on the market that provide that feature. i just wanna know how it's works, how data communicate each other, what tool i should use and what i should learn to make it happen. i ever ask my lecture bout this one, but he never bother me. maybe internet is my only solution to figure this out.
    regards : hpluslabels (sorry for my bad english)
  • Steve_warshaw
    Steve_warshaw
    1 Post
    ACCEPTED ANSWER

    test

    ‏2012-05-03T11:28:05Z  in response to SystemAdmin
    Thanks for the article. No matter what I do, everything comes up null. Event the exception that gets thrown is null!

    If you're still monitoring these comments, I cold use some help!
  • shivaji_sul
    shivaji_sul
    1 Post
    ACCEPTED ANSWER

    test

    ‏2012-09-09T19:25:17Z  in response to SystemAdmin
    thanks ..
    good work....
  • SystemAdmin
    SystemAdmin
    13339 Posts
    ACCEPTED ANSWER

    test

    ‏2013-01-16T00:37:14Z  in response to SystemAdmin
    Note that Androidster have changed the path to their feed. If you download AndroidXML.zip, you need to change
    static String feedUrl = "http://www.androidster.com/android_news.rss/";
    to
    static String feedUrl = "http://www.androidster.com/feed/";
    in the FeedParserFactory.java class.