final String type = getType();
final Document document = eFeed.getDocument();
final String styleSheet = getStyleSheet(document);
final Feed feed = new Feed(type);
feed.setStyleSheet(styleSheet);
final Element title = eFeed.getChild("title", getAtomNamespace());
if (title != null) {
feed.setTitleEx(parseContent(title));
}
final List<Element> links = eFeed.getChildren("link", getAtomNamespace());
feed.setAlternateLinks(parseAlternateLinks(links));
feed.setOtherLinks(parseOtherLinks(links));
final Element author = eFeed.getChild("author", getAtomNamespace());
if (author != null) {
final List<SyndPerson> authors = new ArrayList<SyndPerson>();
authors.add(parsePerson(author));
feed.setAuthors(authors);
}
final List<Element> contributors = eFeed.getChildren("contributor", getAtomNamespace());
if (!contributors.isEmpty()) {
feed.setContributors(parsePersons(contributors));
}
final Element tagline = eFeed.getChild("tagline", getAtomNamespace());
if (tagline != null) {
feed.setTagline(parseContent(tagline));
}
final Element id = eFeed.getChild("id", getAtomNamespace());
if (id != null) {
feed.setId(id.getText());
}
final Element generator = eFeed.getChild("generator", getAtomNamespace());
if (generator != null) {
final Generator gen = new Generator();
gen.setValue(generator.getText());
String att = getAttributeValue(generator, "url");
if (att != null) {
gen.setUrl(att);
}
att = getAttributeValue(generator, "version");
if (att != null) {
gen.setVersion(att);
}
feed.setGenerator(gen);
}
final Element copyright = eFeed.getChild("copyright", getAtomNamespace());
if (copyright != null) {
feed.setCopyright(copyright.getText());
}
final Element info = eFeed.getChild("info", getAtomNamespace());
if (info != null) {
feed.setInfo(parseContent(info));
}
final Element modified = eFeed.getChild("modified", getAtomNamespace());
if (modified != null) {
feed.setModified(DateParser.parseDate(modified.getText(), locale));
}
feed.setModules(parseFeedModules(eFeed, locale));
final List<Element> entries = eFeed.getChildren("entry", getAtomNamespace());
if (!entries.isEmpty()) {
feed.setEntries(parseEntries(entries, locale));
}
final List<Element> foreignMarkup = extractForeignMarkup(eFeed, feed, getAtomNamespace());
if (!foreignMarkup.isEmpty()) {
feed.setForeignMarkup(foreignMarkup);
}
return feed;
}