Package com.rometools.rome.feed.atom

Examples of com.rometools.rome.feed.atom.Content


        aFeed.setId(syndFeed.getUri());

        final SyndContent sTitle = syndFeed.getTitleEx();
        if (sTitle != null) {
            final Content title = new Content();
            title.setType(sTitle.getType());
            title.setValue(sTitle.getValue());
            aFeed.setTitleEx(title);
        }

        final SyndContent sDesc = syndFeed.getDescriptionEx();
        if (sDesc != null) {
            final Content subtitle = new Content();
            subtitle.setType(sDesc.getType());
            subtitle.setValue(sDesc.getValue());
            aFeed.setSubtitle(subtitle);
        }

        // separate SyndEntry's links collection into alternate and other links
        final List<Link> alternateLinks = new ArrayList<Link>();
View Full Code Here


        }
        return atomEntries;
    }

    protected Content createAtomContent(final SyndContent sContent) {
        final Content content = new Content();
        content.setType(sContent.getType());
        content.setValue(sContent.getValue());
        return content;
    }
View Full Code Here

        aEntry.setId(sEntry.getUri());

        final SyndContent sTitle = sEntry.getTitleEx();
        if (sTitle != null) {
            final Content title = new Content();
            title.setType(sTitle.getType());
            title.setValue(sTitle.getValue());
            aEntry.setTitleEx(title);
        }

        final SyndContent sDescription = sEntry.getDescription();
        if (sDescription != null) {
            final Content summary = new Content();
            summary.setType(sDescription.getType());
            summary.setValue(sDescription.getValue());
            aEntry.setSummary(summary);
        }

        // separate SyndEntry's links collection into alternate and other links
        final List<Link> alternateLinks = new ArrayList<Link>();
View Full Code Here

            }
            value = outputter.outputString(contents);

        }

        final Content content = new Content();
        content.setType(type);
        content.setMode(mode);
        content.setValue(value);
        return content;
    }
View Full Code Here

        final com.rometools.rome.feed.atom.Feed feed = new com.rometools.rome.feed.atom.Feed(getType());

        final Element title = eFeed.getChild("title", getAtomNamespace());
        if (title != null) {
            final Content c = new Content();
            c.setValue(parseTextConstructToString(title));
            c.setType(getAttributeValue(title, "type"));
            feed.setTitleEx(c);
        }

        final List<Element> links = eFeed.getChildren("link", getAtomNamespace());
        feed.setAlternateLinks(parseAlternateLinks(feed, null, baseURI, links));
        feed.setOtherLinks(parseOtherLinks(feed, null, baseURI, links));

        final List<Element> categories = eFeed.getChildren("category", getAtomNamespace());
        feed.setCategories(parseCategories(baseURI, categories));

        final List<Element> authors = eFeed.getChildren("author", getAtomNamespace());
        if (!authors.isEmpty()) {
            feed.setAuthors(parsePersons(baseURI, authors, locale));
        }

        final List<Element> contributors = eFeed.getChildren("contributor", getAtomNamespace());
        if (!contributors.isEmpty()) {
            feed.setContributors(parsePersons(baseURI, contributors, locale));
        }

        final Element subtitle = eFeed.getChild("subtitle", getAtomNamespace());
        if (subtitle != null) {
            final Content content = new Content();
            content.setValue(parseTextConstructToString(subtitle));
            content.setType(getAttributeValue(subtitle, "type"));
            feed.setSubtitle(content);
        }

        final Element id = eFeed.getChild("id", getAtomNamespace());
        if (id != null) {
View Full Code Here

        final String value = parseTextConstructToString(e);
        final String src = getAttributeValue(e, "src");
        final String type = getAttributeValue(e, "type");

        final Content content = new Content();
        content.setSrc(src);
        content.setType(type);
        content.setValue(value);
        return content;

    }
View Full Code Here

            entry.setXmlBase(xmlBase);
        }

        final Element title = eEntry.getChild("title", getAtomNamespace());
        if (title != null) {
            final Content c = new Content();
            c.setValue(parseTextConstructToString(title));
            c.setType(getAttributeValue(title, "type"));
            entry.setTitleEx(c);
        }

        final List<Element> links = eEntry.getChildren("link", getAtomNamespace());
        entry.setAlternateLinks(parseAlternateLinks(feed, entry, baseURI, links));
View Full Code Here

    }

    protected void populateFeedHeader(final Feed feed, final Element eFeed) throws FeedException {

        final Content titleEx = feed.getTitleEx();
        if (titleEx != null) {
            final Element titleElement = new Element("title", getFeedNamespace());
            fillContentElement(titleElement, titleEx);
            eFeed.addContent(titleElement);
        }

        final List<Link> alternateLinks = feed.getAlternateLinks();
        if (alternateLinks != null) {
            for (final Link link : alternateLinks) {
                eFeed.addContent(generateLinkElement(link));
            }
        }

        final List<Link> otherLinks = feed.getOtherLinks();
        if (otherLinks != null) {
            for (final Link link : otherLinks) {
                eFeed.addContent(generateLinkElement(link));
            }
        }

        final List<Category> cats = feed.getCategories();
        if (cats != null) {
            for (final Category category : cats) {
                eFeed.addContent(generateCategoryElement(category));
            }
        }

        final List<SyndPerson> authors = feed.getAuthors();
        if (Lists.isNotEmpty(authors)) {
            for (final SyndPerson author : authors) {
                final Element authorElement = new Element("author", getFeedNamespace());
                fillPersonElement(authorElement, author);
                eFeed.addContent(authorElement);
            }
        }

        final List<SyndPerson> contributors = feed.getContributors();
        if (Lists.isNotEmpty(contributors)) {
            for (final SyndPerson contributor : contributors) {
                final Element contributorElement = new Element("contributor", getFeedNamespace());
                fillPersonElement(contributorElement, contributor);
                eFeed.addContent(contributorElement);
            }
        }

        final Content subtitle = feed.getSubtitle();
        if (subtitle != null) {
            final Element subtitleElement = new Element("subtitle", getFeedNamespace());
            fillContentElement(subtitleElement, subtitle);
            eFeed.addContent(subtitleElement);
        }
View Full Code Here

    }

    protected void populateEntry(final Entry entry, final Element eEntry) throws FeedException {

        final Content titleEx = entry.getTitleEx();
        if (titleEx != null) {
            final Element titleElement = new Element("title", getFeedNamespace());
            fillContentElement(titleElement, titleEx);
            eEntry.addContent(titleElement);
        }

        final List<Link> alternateLinks = entry.getAlternateLinks();
        if (alternateLinks != null) {
            for (final Link link : alternateLinks) {
                eEntry.addContent(generateLinkElement(link));
            }
        }

        final List<Link> otherLinks = entry.getOtherLinks();
        if (otherLinks != null) {
            for (final Link link : otherLinks) {
                eEntry.addContent(generateLinkElement(link));
            }
        }

        final List<Category> cats = entry.getCategories();
        if (cats != null) {
            for (final Category category : cats) {
                eEntry.addContent(generateCategoryElement(category));
            }
        }

        final List<SyndPerson> authors = entry.getAuthors();
        if (Lists.isNotEmpty(authors)) {
            for (final SyndPerson author : authors) {
                final Element authorElement = new Element("author", getFeedNamespace());
                fillPersonElement(authorElement, author);
                eEntry.addContent(authorElement);
            }
        }

        final List<SyndPerson> contributors = entry.getContributors();
        if (Lists.isNotEmpty(contributors)) {
            for (final SyndPerson contributor : contributors) {
                final Element contributorElement = new Element("contributor", getFeedNamespace());
                fillPersonElement(contributorElement, contributor);
                eEntry.addContent(contributorElement);
            }
        }

        final String id = entry.getId();
        if (id != null) {
            eEntry.addContent(generateSimpleElement("id", id));
        }

        final Date updated = entry.getUpdated();
        if (updated != null) {
            final Element updatedElement = new Element("updated", getFeedNamespace());
            updatedElement.addContent(DateParser.formatW3CDateTime(updated, Locale.US));
            eEntry.addContent(updatedElement);
        }

        final Date published = entry.getPublished();
        if (published != null) {
            final Element publishedElement = new Element("published", getFeedNamespace());
            publishedElement.addContent(DateParser.formatW3CDateTime(published, Locale.US));
            eEntry.addContent(publishedElement);
        }

        final List<Content> contents = entry.getContents();
        if (Lists.isNotEmpty(contents)) {
            final Element contentElement = new Element("content", getFeedNamespace());
            final Content content = contents.get(0);
            fillContentElement(contentElement, content);
            eEntry.addContent(contentElement);
        }

        final Content summary = entry.getSummary();
        if (summary != null) {
            final Element summaryElement = new Element("summary", getFeedNamespace());
            fillContentElement(summaryElement, summary);
            eEntry.addContent(summaryElement);
        }
View Full Code Here

public class TestAtomContent extends TestCase {

    private Feed createFeed() {
        final Feed feed = new Feed();
        final Content content = new Content();
        content.setType("application/xml");
        content.setValue("<test>Hello Hello</test>");
        feed.setTitleEx(content);
        feed.setFeedType("atom_1.0");
        return feed;
    }
View Full Code Here

TOP

Related Classes of com.rometools.rome.feed.atom.Content

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.