/** * Creates a SyndFeedInput instance. * <p> * @param validate indicates if the input should be validated. NOT IMPLEMENTED YET (validation does not happen) * */ public SyndFeedInput(boolean validate) { _feedInput = new WireFeedInput(validate); }
/** * Builds SyndFeedImpl from an W3C SAX InputSource. * <p> * @param is W3C SAX InputSource to read to create the SyndFeedImpl. * @return the SyndFeedImpl read from the W3C SAX InputSource. * @throws IllegalArgumentException thrown if feed type could not be understood by any of the underlying parsers. * @throws FeedException if the feed could not be parsed * */ public SyndFeed build(InputSource is) throws IllegalArgumentException,FeedException { return new SyndFeedImpl(_feedInput.build(is), preserveWireFeed); }
/** * Returns the list of supported input feed types. * <p> * @see WireFeed for details on the format of these strings. * <p> * @return a list of String elements with the supported input feed types. * */ public static List getSupportedFeedTypes() { return getFeedParsers().getSupportedFeedTypes(); }
public Feed readFrom( Class<Feed> type, Type genericType, Annotation annotations[], MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { try { WireFeedInput input = new WireFeedInput(); WireFeed wireFeed = input.build(new InputStreamReader(entityStream)); if (!(wireFeed instanceof Feed)) { throw new IOException(ImplMessages.ERROR_NOT_ATOM_FEED(type)); } return (Feed)wireFeed; } catch (FeedException cause) { IOException effect = new IOException(ImplMessages.ERROR_MARSHALLING_ATOM(type)); effect.initCause(cause); throw effect; } }
/** * Builds an WireFeed (RSS or Atom) from an W3C SAX InputSource. * <p> * NOTE: This method delages to the 'AsbtractFeed WireFeedInput#build(org.jdom.Document)'. * <p> * @param is W3C SAX InputSource to read to create the WireFeed. * @return the WireFeed read from the W3C SAX InputSource. * @throws IllegalArgumentException thrown if feed type could not be understood by any of the underlying parsers. * @throws FeedException if the feed could not be parsed * */ public WireFeed build(InputSource is) throws IllegalArgumentException,FeedException { SAXBuilder saxBuilder = createSAXBuilder(); try { Document document = saxBuilder.build(is); return build(document); } catch (JDOMParseException ex) { throw new ParsingFeedException("Invalid XML: " + ex.getMessage(), ex); } catch (IllegalArgumentException ex) { throw ex; } catch (Exception ex) { throw new ParsingFeedException("Invalid XML",ex); } }
/** * Enables XML healing in the WiredFeedInput instance. * <p> * Healing trims leading chars from the stream (empty spaces and comments) until the XML prolog. * <p> * Healing resolves HTML entities (from literal to code number) in the reader. * <p> * The healing is done only with the build(File) and build(Reader) signatures. * <p> * By default is TRUE. * <p> * @param heals TRUE enables stream healing, FALSE disables it. * */ public void setXmlHealerOn(boolean heals) { _feedInput.setXmlHealerOn(heals); }
/** * Indicates if the WiredFeedInput instance will XML heal (if necessary) the character stream. * <p> * Healing trims leading chars from the stream (empty spaces and comments) until the XML prolog. * <p> * Healing resolves HTML entities (from literal to code number) in the reader. * <p> * The healing is done only with the build(File) and build(Reader) signatures. * <p> * By default is TRUE. * <p> * @return TRUE if healing is enabled, FALSE if not. * */ public boolean getXmlHealerOn() { return _feedInput.getXmlHealerOn(); }
public Feed readFrom( Class<Feed> type, Type genericType, Annotation annotations[], MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { try { WireFeedInput input = new WireFeedInput(); WireFeed wireFeed = input.build(new InputStreamReader(entityStream)); if (!(wireFeed instanceof Feed)) { throw new IOException(ImplMessages.ERROR_NOT_ATOM_FEED(type)); } return (Feed)wireFeed; } catch (FeedException cause) { IOException effect = new IOException(ImplMessages.ERROR_MARSHALLING_ATOM(type)); effect.initCause(cause); throw effect; } }
/** * Builds an WireFeed (RSS or Atom) from an W3C SAX InputSource. * <p> * NOTE: This method delages to the 'AsbtractFeed WireFeedInput#build(org.jdom2.Document)'. * <p> * @param is W3C SAX InputSource to read to create the WireFeed. * @return the WireFeed read from the W3C SAX InputSource. * @throws IllegalArgumentException thrown if feed type could not be understood by any of the underlying parsers. * @throws FeedException if the feed could not be parsed * */ public WireFeed build(InputSource is) throws IllegalArgumentException,FeedException { SAXBuilder saxBuilder = createSAXBuilder(); try { Document document = saxBuilder.build(is); return build(document); } catch (JDOMParseException ex) { throw new ParsingFeedException("Invalid XML: " + ex.getMessage(), ex); } catch (IllegalArgumentException ex) { throw ex; } catch (Exception ex) { throw new ParsingFeedException("Invalid XML",ex); } }
/** * Enables XML healing in the WiredFeedInput instance. * <p> * Healing trims leading chars from the stream (empty spaces and comments) until the XML prolog. * <p> * Healing resolves HTML entities (from literal to code number) in the reader. * <p> * The healing is done only with the build(File) and build(Reader) signatures. * <p> * By default is TRUE. * <p> * @param heals TRUE enables stream healing, FALSE disables it. * */ public void setXmlHealerOn(boolean heals) { _feedInput.setXmlHealerOn(heals); }
/** * Indicates if the WiredFeedInput instance will XML heal (if necessary) the character stream. * <p> * Healing trims leading chars from the stream (empty spaces and comments) until the XML prolog. * <p> * Healing resolves HTML entities (from literal to code number) in the reader. * <p> * The healing is done only with the build(File) and build(Reader) signatures. * <p> * By default is TRUE. * <p> * @return TRUE if healing is enabled, FALSE if not. * */ public boolean getXmlHealerOn() { return _feedInput.getXmlHealerOn(); }
public Feed readFrom( Class<Feed> type, Type genericType, Annotation annotations[], MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { try { WireFeedInput input = new WireFeedInput(); WireFeed wireFeed = input.build(new InputStreamReader(entityStream)); if (!(wireFeed instanceof Feed)) { throw new IOException(ImplMessages.ERROR_NOT_ATOM_FEED(type)); } return (Feed)wireFeed; } catch (FeedException cause) { IOException effect = new IOException(ImplMessages.ERROR_MARSHALLING_ATOM(type)); effect.initCause(cause); throw effect; } }
/** * Builds SyndFeedImpl from an JDOM document. * <p> * @param document JDOM document to read to create the SyndFeedImpl. * @return the SyndFeedImpl read from the JDOM document. * @throws IllegalArgumentException thrown if feed type could not be understood by any of the underlying parsers. * @throws FeedException if the feed could not be parsed * */ public SyndFeed build(Document document) throws IllegalArgumentException,FeedException { return new SyndFeedImpl(_feedInput.build(document), preserveWireFeed); }
/** * Builds an WireFeed (RSS or Atom) from an W3C SAX InputSource. * <p> * NOTE: This method delages to the 'AsbtractFeed WireFeedInput#build(org.jdom.Document)'. * <p> * @param is W3C SAX InputSource to read to create the WireFeed. * @return the WireFeed read from the W3C SAX InputSource. * @throws IllegalArgumentException thrown if feed type could not be understood by any of the underlying parsers. * @throws FeedException if the feed could not be parsed * */ public WireFeed build(InputSource is) throws IllegalArgumentException,FeedException { SAXBuilder saxBuilder = createSAXBuilder(); try { Document document = saxBuilder.build(is); return build(document); } catch (JDOMParseException ex) { throw new ParsingFeedException("Invalid XML: " + ex.getMessage(), ex); } catch (IllegalArgumentException ex) { throw ex; } catch (Exception ex) { throw new ParsingFeedException("Invalid XML",ex); } }
/** * Creates a SyndFeedInput instance. * <p> * @param validate indicates if the input should be validated. NOT IMPLEMENTED YET (validation does not happen) * */ public SyndFeedInput(boolean validate) { _feedInput = new WireFeedInput(validate); }
/** * Returns the list of supported input feed types. * <p> * @see WireFeed for details on the format of these strings. * <p> * @return a list of String elements with the supported input feed types. * */ public static List getSupportedFeedTypes() { return getFeedParsers().getSupportedFeedTypes(); }
/** * Enables XML healing in the WiredFeedInput instance. * <p> * Healing trims leading chars from the stream (empty spaces and comments) until the XML prolog. * <p> * Healing resolves HTML entities (from literal to code number) in the reader. * <p> * The healing is done only with the build(File) and build(Reader) signatures. * <p> * By default is TRUE. * <p> * @param heals TRUE enables stream healing, FALSE disables it. * */ public void setXmlHealerOn(boolean heals) { _feedInput.setXmlHealerOn(heals); }
/** * Indicates if the WiredFeedInput instance will XML heal (if necessary) the character stream. * <p> * Healing trims leading chars from the stream (empty spaces and comments) until the XML prolog. * <p> * Healing resolves HTML entities (from literal to code number) in the reader. * <p> * The healing is done only with the build(File) and build(Reader) signatures. * <p> * By default is TRUE. * <p> * @return TRUE if healing is enabled, FALSE if not. * */ public boolean getXmlHealerOn() { return _feedInput.getXmlHealerOn(); }
/** * Parse entry from InputStream. */ private static Entry parseEntry(InputStream in) throws JDOMException, IOException, IllegalArgumentException, FeedException { // Parse entry into JDOM tree SAXBuilder builder = new SAXBuilder(); Document entryDoc = builder.build(in); Element fetchedEntryElement = entryDoc.getRootElement(); fetchedEntryElement.detach(); // Put entry into a JDOM document with 'feed' root so that Rome can handle it Feed feed = new Feed(); feed.setFeedType(FEED_TYPE); WireFeedOutput wireFeedOutput = new WireFeedOutput(); Document feedDoc = wireFeedOutput.outputJDom(feed); feedDoc.getRootElement().addContent(fetchedEntryElement); WireFeedInput input = new WireFeedInput(); Feed parsedFeed = (Feed)input.build(feedDoc); return (Entry)parsedFeed.getEntries().get(0); }
/** * Builds SyndFeedImpl from an Reader. * <p> * @param reader Reader to read to create the SyndFeedImpl. * @return the SyndFeedImpl read from the Reader. * @throws IllegalArgumentException thrown if feed type could not be understood by any of the underlying parsers. * @throws FeedException if the feed could not be parsed * */ public SyndFeed build(Reader reader) throws IllegalArgumentException,FeedException { return new SyndFeedImpl(_feedInput.build(reader), preserveWireFeed); }