Package com.attribyte.parser.entry
Class FeedParser
java.lang.Object
com.attribyte.parser.entry.FeedParser
- All Implemented Interfaces:
Parser
- Direct Known Subclasses:
AtomParser,RSSParser
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static Entry.BuilderaddImage(Entry.Builder entry, Image.Builder builder) Adds an image to an entry and if entry has no primary image, sets primary image to this image.protected static Entry.BuilderaddImage(Entry.Builder entry, String url, String protocol) Adds an image to an entry if a valid URL and sets the primary image, if unset.protected static Image.BuilderCreate an image builder for a URL.parse(String content, String sourceLink, ContentCleaner contentCleaner) Parse content.protected abstract voidparseEntries(org.jsoup.nodes.Document doc, ContentCleaner contentCleaner, Resource.Builder resource) Parse all entries and add to the resource.protected abstract Entry.BuilderparseEntry(org.jsoup.nodes.Element elem, ContentCleaner contentCleaner, String baseUri) Parse an entry.protected abstract voidparseSource(org.jsoup.nodes.Document doc, Resource.Builder resource) Parse the feed source properties.
-
Constructor Details
-
FeedParser
public FeedParser()
-
-
Method Details
-
parse
Description copied from interface:ParserParse content. -
parseSource
Parse the feed source properties.- Parameters:
doc- The parsed document.resource- The resource to which source properties are added.
-
parseEntry
protected abstract Entry.Builder parseEntry(org.jsoup.nodes.Element elem, ContentCleaner contentCleaner, String baseUri) Parse an entry.- Parameters:
elem- The entry element.contentCleaner- The content cleaner.baseUri- The base URI for relative references.- Returns:
- The parsed entry (builder).
-
parseEntries
protected abstract void parseEntries(org.jsoup.nodes.Document doc, ContentCleaner contentCleaner, Resource.Builder resource) Parse all entries and add to the resource.- Parameters:
doc- The parent document.contentCleaner- The content cleaner.resource- The resource.
-
image
Create an image builder for a URL.- Parameters:
url- The URL.protocol- For protocol-less links.- Returns:
- The builder or
null.
-
addImage
Adds an image to an entry and if entry has no primary image, sets primary image to this image.- Parameters:
entry- The entry (builder).builder- The image builder.- Returns:
- The input entry builder.
-
addImage
Adds an image to an entry if a valid URL and sets the primary image, if unset.- Parameters:
entry- The entry.url- The url.protocol- The protocol to use for protocol-less links.- Returns:
- The input entry builder.
-