Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Flickr XML - how to get data inside a tag?

Options
  • 27-03-2009 6:40pm
    #1
    Registered Users 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,171 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 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