How to get tweet updates in XML format using java

NicoleJ

New Member
I have following code that outputs my and my users twitter time line messages in java.I followed this tutorial to get the code below http://namingexception.wordpress.com/2011/09/12/how-easy-to-make-your-own-twitter-client-using-java/\[code\]import java.io.IOException;import java.util.List;import twitter4j.Status;import twitter4j.Twitter;import twitter4j.TwitterException;import twitter4j.TwitterFactory;import twitter4j.auth.AccessToken;public class SimpleTweet {List<Status> statuses;private final static String CONSUMER_KEY = "XXXXXX";private final static String CONSUMER_KEY_SECRET = "XXXXXXX-123";public void start() throws TwitterException, IOException {Twitter twitter = new TwitterFactory().getInstance();twitter.setOAuthConsumer(CONSUMER_KEY, CONSUMER_KEY_SECRET);String accessToken = getSavedAccessToken();String accessTokenSecret = getSavedAccessTokenSecret();AccessToken oathAccessToken = new AccessToken(accessToken,accessTokenSecret);twitter.setOAuthAccessToken(oathAccessToken);twitter.updateStatus("Hello world :)."); statuses = twitter.getHomeTimeline();for (Status each : statuses) { System.out.println("Sent by: @" + each.getUser().getScreenName() + " - " + each.getUser().getName() + "\n" + each.getText() + "\n");} }// start method ends hereprivate String getSavedAccessTokenSecret() {return "vxcvvxcvxcvx";}private String getSavedAccessToken() {return "eweweqweqweqwe";} public static void main(String[] args) throws Exception {new SimpleTweet().start(); } }\[/code\]And I get following output\[code\]Sent by: @tweetrr - rrHello to all :).Sent by: @addthis - AddThisJust in time for @wordcampnyc, we have updated the AddThis WordPress plugin! Check it: http://t.co/cgOgRwyl\[/code\]Now I want the output to be in XML format. I would like to know if there are API's that does this work. Thanks in advance
 
Back
Top