Top Description Fields Constructors Methods
com.rometools.rome.io.impl

public Class Atom10Parser

extends BaseWireFeedParser
Class Inheritance
Imports
java.io.IOException, .Reader, java.net.MalformedURLException, java.util.ArrayList, .List, .Locale, java.util.regex.Pattern, org.jdom2.Attribute, .Document, .Element, .JDOMException, .Namespace, .Parent, org.jdom2.input.SAXBuilder, org.jdom2.output.XMLOutputter, com.rometools.rome.feed.WireFeed, com.rometools.rome.feed.atom.Category, .Content, .Entry, .Feed, .Generator, .Link, .Person, com.rometools.rome.feed.synd.SyndPerson, com.rometools.rome.io.FeedException, .WireFeedInput, .WireFeedOutput, com.rometools.utils.Lists

Parser for Atom 1.0

Field Summary

Modifier and TypeField and Description
pack-priv static Pattern
private static final Namespace
private static final String
private static boolean

Constructor Summary

AccessConstructor and Description
public
protected
Atom10Parser(final String type)

Method Summary

Modifier and TypeMethod and Description
private String
findBaseURI(final Element
Root element of feed.
root
)

Find base URI of feed considering relative URIs.

private static String
formURI(String
Base of URI, may end with trailing slash
base
,
String
String to append, may begin with slash or ".."
append
)

Form URI by combining base with append portion and giving special consideration to append portions that begin with ".."

protected Namespace
public static boolean
public static boolean
isAbsoluteURI(final String uri)

public boolean
isMyType(final Document
XML Document (JDOM) to check if it can be parsed by this parser.
document
)

Implements com.rometools.rome.io.WireFeedParser.isMyType.

Inspects an XML Document (JDOM) to check if it can parse it.
public static boolean
isRelativeURI(final String uri)

Returns true if URI is relative.

public WireFeed
parse(final Document
XML document (JDOM) to parse.
document
,
final boolean
indicates if the feed should be strictly validated (NOT YET IMPLEMENTED).
validate
,
final Locale locale)

Implements com.rometools.rome.io.WireFeedParser.parse.

Parses an XML document (JDOM Document) into a feed bean.
private List<Category>
parseCategories(final String baseURI, final List<Element> eCategories)

private Category
parseCategory(final String baseURI, final Element eCategory)

private Content
protected List<Entry>
parseEntries(final Feed feed, final String baseURI, final List<Element> eEntries, final Locale locale)

protected Entry
parseEntry(final Feed feed, final Element eEntry, final String baseURI, final Locale locale)

public static Entry
parseEntry(final Reader rd, final String baseURI, final Locale locale)

Parse entry from reader.

protected WireFeed
parseFeed(final Element eFeed, final Locale locale)

private Feed
parseFeedMetadata(final String baseURI, final Element eFeed, final Locale locale)

private Person
parsePerson(final String baseURI, final Element ePerson, final Locale locale)

private List<SyndPerson>
parsePersons(final String baseURI, final List<Element> ePersons, final Locale locale)

private String
public static String
resolveURI(final String
Base URI used to fetch the XML document
baseURI
,
final Parent
Parent element from which to consider xml:base
parent
,
String
URL to be resolved
url
)

Resolve URI via base URL and parent element.

public static void
setResolveURIs(final boolean resolveURIs)

private static String
stripStartingSlash(String s)

Strip starting slash from beginning of string.

private static String
stripTrailingSlash(String s)

Strip trailing slash from end of string.

protected void
validateFeed(final Document document)

Inherited from com.rometools.rome.io.impl.BaseWireFeedParser:
extractForeignMarkupgetAttributegetAttributeValuegetStyleSheetgetTypeparseFeedModulesparseItemModulesparsePersonModules

Field Detail

absoluteURIPatternback to summary
pack-priv static Pattern absoluteURIPattern
ATOM_10_NSback to summary
private static final Namespace ATOM_10_NS
ATOM_10_URIback to summary
private static final String ATOM_10_URI
resolveURIsback to summary
private static boolean resolveURIs

Constructor Detail

Atom10Parserback to summary
public Atom10Parser()
Atom10Parserback to summary
protected Atom10Parser(final String type)

Method Detail

findBaseURIback to summary
private String findBaseURI(final Element root) throws MalformedURLException

Find base URI of feed considering relative URIs.

Parameters
root:Element

Root element of feed.

formURIback to summary
private static String formURI(String base, String append)

Form URI by combining base with append portion and giving special consideration to append portions that begin with ".."

Parameters
base:String

Base of URI, may end with trailing slash

append:String

String to append, may begin with slash or ".."

getAtomNamespaceback to summary
protected Namespace getAtomNamespace()
getResolveURIsback to summary
public static boolean getResolveURIs()
isAbsoluteURIback to summary
public static boolean isAbsoluteURI(final String uri)
isMyTypeback to summary
public boolean isMyType(final Document document)

Implements com.rometools.rome.io.WireFeedParser.isMyType.

Doc from com.rometools.rome.io.WireFeedParser.isMyType.

Inspects an XML Document (JDOM) to check if it can parse it.

It checks if the given document if the type of feeds the parser understands.

Parameters
document:Document

XML Document (JDOM) to check if it can be parsed by this parser.

Returns:boolean

true if the parser know how to parser this feed, false otherwise.

Annotations
@Override
isRelativeURIback to summary
public static boolean isRelativeURI(final String uri)

Returns true if URI is relative.

parseback to summary
public WireFeed parse(final Document document, final boolean validate, final Locale locale) throws IllegalArgumentException, FeedException

Implements com.rometools.rome.io.WireFeedParser.parse.

Doc from com.rometools.rome.io.WireFeedParser.parse.

Parses an XML document (JDOM Document) into a feed bean.

Parameters
document:Document

XML document (JDOM) to parse.

validate:boolean

indicates if the feed should be strictly validated (NOT YET IMPLEMENTED).

Returns:WireFeed

the resulting feed bean.

Annotations
@Override
Exceptions
IllegalArgumentException:
thrown if the parser cannot handle the given feed type.
FeedException:
thrown if a feed bean cannot be created out of the XML document (JDOM).
parseCategoriesback to summary
private List<Category> parseCategories(final String baseURI, final List<Element> eCategories)
parseCategoryback to summary
private Category parseCategory(final String baseURI, final Element eCategory)
parseContentback to summary
private Content parseContent(final Element e)
parseEntriesback to summary
protected List<Entry> parseEntries(final Feed feed, final String baseURI, final List<Element> eEntries, final Locale locale)
parseEntryback to summary
protected Entry parseEntry(final Feed feed, final Element eEntry, final String baseURI, final Locale locale)
parseEntryback to summary
public static Entry parseEntry(final Reader rd, final String baseURI, final Locale locale) throws JDOMException, IOException, IllegalArgumentException, FeedException

Parse entry from reader.

parseFeedback to summary
protected WireFeed parseFeed(final Element eFeed, final Locale locale) throws FeedException
parseFeedMetadataback to summary
private Feed parseFeedMetadata(final String baseURI, final Element eFeed, final Locale locale)
parsePersonback to summary
private Person parsePerson(final String baseURI, final Element ePerson, final Locale locale)
parsePersonsback to summary
private List<SyndPerson> parsePersons(final String baseURI, final List<Element> ePersons, final Locale locale)
parseTextConstructToStringback to summary
private String parseTextConstructToString(final Element e)
resolveURIback to summary
public static String resolveURI(final String baseURI, final Parent parent, String url)

Resolve URI via base URL and parent element. Resolve URI based considering xml:base and baseURI.

Parameters
baseURI:String

Base URI used to fetch the XML document

parent:Parent

Parent element from which to consider xml:base

url:String

URL to be resolved

setResolveURIsback to summary
public static void setResolveURIs(final boolean resolveURIs)
stripStartingSlashback to summary
private static String stripStartingSlash(String s)

Strip starting slash from beginning of string.

stripTrailingSlashback to summary
private static String stripTrailingSlash(String s)

Strip trailing slash from end of string.

validateFeedback to summary
protected void validateFeed(final Document document) throws FeedException