Пример #1
0
 /**
  * Extracts a list of users
  *
  * @param response an XML-formatted response
  * @return the list of users
  * @throws SAXException
  * @throws ParserConfigurationException
  * @throws IOException
  */
 @SuppressWarnings("unchecked")
 public List<TwitterUser> readUsers(ReadableResponse response)
     throws SAXException, ParserConfigurationException, IOException {
   List<TwitterUser> list =
       (List<TwitterUser>) Utils.parseXML(response, new TwitterParsingUsers());
   return list;
 }
Пример #2
0
 /**
  * Extracts a URL
  *
  * @param response an XML-formatted response
  * @return the URL extracted
  * @throws SAXException
  * @throws ParserConfigurationException
  * @throws IOException
  */
 @SuppressWarnings("unchecked")
 public String readUrl(ReadableResponse response)
     throws SAXException, ParserConfigurationException, IOException {
   List<String> list = (List<String>) Utils.parseXML(response, new TwitterParsingUrl());
   if (list.size() == 1) return list.get(0);
   return null;
 }
Пример #3
0
 /**
  * Extracts a single LinkedInUser
  *
  * @param response an XML-formatted response
  * @return the target user
  * @throws SAXException
  * @throws ParserConfigurationException
  * @throws IOException
  */
 @SuppressWarnings("unchecked")
 public LinkedInUser readUser(ReadableResponse response)
     throws SAXException, ParserConfigurationException, IOException {
   List<LinkedInUser> list =
       (List<LinkedInUser>) Utils.parseXML(response, new LinkedInParsingUsers(true));
   if (list.size() == 1) return list.get(0);
   else return null;
 }
Пример #4
0
 /**
  * Determines whether an action was successful or not The message of the response is printed on
  * the debug output
  *
  * @param response an XML-formatted response
  * @return true if the operation was successful
  * @throws SAXException
  * @throws ParserConfigurationException
  * @throws IOException
  * @throws OperationException
  */
 @SuppressWarnings("unchecked")
 public boolean readResponse(ReadableResponse response)
     throws SAXException, ParserConfigurationException, IOException, OperationException {
   List<String> list = (List<String>) Utils.parseXML(response, new TwitterParsingResponse());
   if (list.size() == 1) {
     if (list.get(0).equals("true")) {
       return true;
     } else if (list.get(0).equals("false")) {
       return false;
     } else {
       throw new OperationException(list.get(0));
     }
   }
   return false;
 }
Пример #5
0
 /**
  * Extracts a list of LinkedInConnectionPosts
  *
  * @param response an XML-formatted response
  * @return the list of connection posts
  * @throws SAXException
  * @throws ParserConfigurationException
  * @throws IOException
  */
 @SuppressWarnings("unchecked")
 public List<LinkedInConnectionPost> readConnectionPosts(ReadableResponse response)
     throws SAXException, ParserConfigurationException, IOException {
   return (List<LinkedInConnectionPost>)
       Utils.parseXML(response, new LinkedInParsingConnectionPosts());
 }
Пример #6
0
 /**
  * Extracts a list of LinkedInUsers
  *
  * @param response an XML-formatted response
  * @return the list of users
  * @throws SAXException
  * @throws ParserConfigurationException
  * @throws IOException
  */
 @SuppressWarnings("unchecked")
 public List<LinkedInUser> readUsers(ReadableResponse response)
     throws SAXException, ParserConfigurationException, IOException {
   return (List<LinkedInUser>) Utils.parseXML(response, new LinkedInParsingUsers(false));
 }