1 Reply Latest reply: Nov 2, 2009 9:00 AM by 791266 RSS

    Get more than 1 URL from inputStream

    843789
      Hi, I'm trying to get information from twitter using inputstream but wishes to get more results. am currently able to get maximum 100 results and store into a javabean but wishes to get more but limited to the api and wants to use a loop to get the information but not sure how to go about it. Any help would be appreciated. Thks!
         XMLInputFactory inputFactory = XMLInputFactory.newInstance();
                  InputStream in = new URL("http://search.twitter.com/search.atom?q=" + search + "&page=1&rpp=100").openStream();
            
                  System.out.println(in);
                  XMLEventReader eventReader = inputFactory.createXMLEventReader(in);
                  
                  boolean inEntry = false;
                  Item currentItem = null;
                  
                  while (eventReader.hasNext()) {      
                     XMLEvent event = eventReader.nextEvent();      
      
                     if (event.isStartElement()) {
                          StartElement startElement = event.asStartElement();
                          
                         if (event.asStartElement().getName().getLocalPart().equals("title")) {
                              event = eventReader.nextEvent();
                              String title = event.asCharacters().getData();
                             
                              if (!inEntry) {
                                   channel.setTitle(title);//false
                              } else {
                                   currentItem.setTitle(title);//true
                              }
                                                     
                             continue;
                         }