Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Flickr XML - how to get data inside a tag?

  • 27-03-2009 06:40PM
    #1
    Registered Users, Registered Users 2 Posts: 18,272 ✭✭✭✭


    I'm currently creating a midp app that takes a username and pulls back there public photos from Flickr

    What I want to do is pull back the comments for that photo too.

    here is the xml code that I get when i look for comments on a photo
    <rsp stat="ok">
    &#8722;
    <comments photo_id="3349474073">
    <comment id="36236840-3349474073-72157615949979962" author="36282162@N06" authorname="draffo3" datecreate="1238108388" permalink="http://www.flickr.com/photos/36282162@N06/3349474073/#comment72157615949979962">Honda - The power of dreams?</comment>
    <comment id="36236840-3349474073-72157615885574409" author="36282162@N06" authorname="draffo3" datecreate="1238153902" permalink="http://www.flickr.com/photos/36282162@N06/3349474073/#comment72157615885574409">Comment Test 2</comment>
    <comment id="36236840-3349474073-72157615973052366" author="36282162@N06" authorname="draffo3" datecreate="1238153911" permalink="http://www.flickr.com/photos/36282162@N06/3349474073/#comment72157615973052366">comment test 3</comment>
    </comments>
    </rsp>
    

    And here is my java code which lets me get all the attributes from the xml, but I cant get at the actual comment itself inside the comment tag
    public void processStart(String tree, Hashtable a) {
          System.out.println("in process start");
          System.out.println("Tree = : " + tree);
        if (tree.equals("rsp|comments")) {
            System.out.println("tree = comments | comment");
            Enumeration keys = a.keys();
            while (keys.hasMoreElements()) {
                
                String comment = (String)keys.nextElement();
                System.out.println("Keys = " + comment);
                String value = (String)a.get(comment);
                
              if (comment.equals("authorname"))
              mComment = value;
                System.out.println("comment value = " + value);
            }
            
          
          if (mCommentURLs == null)
            mCommentURLs = new Vector();
          System.out.println("Vector created");
          
          mCommentURLs.addElement(mComment);
          System.out.println("element added");
        }
      }
    

    So my question is would anyone know how to get the actual comment? as in the first comment says Honda - The power of dreams? which is the text within the tag, how would I get that out?


Comments

  • Moderators, Education Moderators, Home & Garden Moderators Posts: 8,313 Mod ✭✭✭✭Jonathan


    I have absolutely no experience in java, let alone j2me, but is there regular expressions support? If there is, it should be pretty easy.


  • Registered Users, Registered Users 2 Posts: 18,272 ✭✭✭✭Atomic Pineapple


    jmccrohan wrote: »
    I have absolutely no experience in java, let alone j2me, but is there regular expressions support? If there is, it should be pretty easy.

    Got it! All I had to do was change the hashtable to take in the string of the tag


Advertisement