Package com.rometools.rome.io

Examples of com.rometools.rome.io.WireFeedInput


  @Override
  @SuppressWarnings("unchecked")
  protected T readInternal(Class<? extends T> clazz, HttpInputMessage inputMessage)
      throws IOException, HttpMessageNotReadableException {

    WireFeedInput feedInput = new WireFeedInput();
    MediaType contentType = inputMessage.getHeaders().getContentType();
    Charset charset =
        (contentType != null && contentType.getCharSet() != null? contentType.getCharSet() : DEFAULT_CHARSET);
    try {
      Reader reader = new InputStreamReader(inputMessage.getBody(), charset);
      return (T) feedInput.build(reader);
    }
    catch (FeedException ex) {
      throw new HttpMessageNotReadableException("Could not read WireFeed: " + ex.getMessage(), ex);
    }
  }
View Full Code Here


  private final FeedSubscriptionService feedSubscriptionService;
  private final CacheService cache;

  public void importOpml(User user, String xml) {
    xml = xml.substring(xml.indexOf('<'));
    WireFeedInput input = new WireFeedInput();
    try {
      Opml feed = (Opml) input.build(new StringReader(xml));
      List<Outline> outlines = feed.getOutlines();
      for (Outline outline : outlines) {
        handleOutline(user, outline, null);
      }
    } catch (Exception e) {
View Full Code Here

        if (baseURI != null) {
            feedDoc.getRootElement().setAttribute("base", baseURI, Namespace.XML_NAMESPACE);
        }

        final WireFeedInput input = new WireFeedInput(false, locale);
        final Feed parsedFeed = (Feed) input.build(feedDoc);
        return parsedFeed.getEntries().get(0);
    }
View Full Code Here

        final SAXBuilder saxBuilder = new SAXBuilder(XMLReaders.NONVALIDATING);
        return saxBuilder.build(getFeedReader());
    }

    protected WireFeed getWireFeed() throws Exception {
        final WireFeedInput in = new WireFeedInput();
        return in.build(getFeedReader());
    }
View Full Code Here

        final StringWriter sw = new StringWriter();
        final WireFeedOutput output = new WireFeedOutput();
        output.output(feed, sw);
        sw.close();
        final StringReader reader = new StringReader(sw.toString());
        final WireFeedInput input = new WireFeedInput();
        feed = (Feed) input.build(reader);
        reader.close();
        assertEquals("<test>Hello Hello</test>", feed.getTitleEx().getValue().trim());
    }
View Full Code Here

TOP

Related Classes of com.rometools.rome.io.WireFeedInput

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.