Package com.sun.syndication.io

Examples of com.sun.syndication.io.FeedException


    // maxLen == -1 means unlimited.
    protected void checkNotNullAndLength(Element parent, String childName, int minLen, int maxLen) throws FeedException {
        Element  child = parent.getChild(childName,getFeedNamespace());
        if (child == null) {
            throw new FeedException("Invalid "+getType()+" feed, missing "+parent.getName()+" "+childName);
        }
        checkLength(parent,childName,minLen,maxLen);
    }
View Full Code Here


    // maxLen == -1 means unlimited.
    protected void checkLength(Element parent, String childName, int minLen, int maxLen) throws FeedException {
        Element  child = parent.getChild(childName,getFeedNamespace());
        if (child != null) {
            if (minLen>0 && child.getText().length()<minLen) {
                throw new FeedException("Invalid "+getType()+" feed, "+parent.getName()+" "+childName + "short of "+minLen+" length");
            }
            if (maxLen>-1 && child.getText().length()>maxLen) {
                throw new FeedException("Invalid "+getType()+" feed, "+parent.getName()+" "+childName + "exceeds "+maxLen+" length");
            }
        }
    }
View Full Code Here

    }

    protected void checkItemsConstraints(Element parent) throws FeedException {
        int count = parent.getChildren("item",getFeedNamespace()).size();
        if (count<1 || count>15) {
            throw new FeedException("Invalid "+getType()+" feed, item count is "+count+" it must be between 1 an 15");
        }
    }
View Full Code Here

        Element root = new Element("rss");
        Attribute version = new Attribute("version", getVersion());
        root.setAttribute(version);

        if (channel == null) {
            throw new FeedException("invalid RSS Channel - missing required channel element");
        }
        root.addContent(generateChannelElement(channel));
        return root;

    }
View Full Code Here

        String title = channel.getTitle();
        String link = channel.getLink();
        String description = channel.getDescription();

        if (title == null) {
            throw new FeedException("invalid RSS Channel - missing required title element");
        }
        if (link == null) {
            throw new FeedException("invalid RSS Channel - missing required link element");
        }
        if (description == null) {
            throw new FeedException("invalid RSS Channel - missing required description element");
        }

        Element channelElement = new Element("channel");
        channelElement.addContent(generateSimpleElement("title", title));
        channelElement.addContent(generateSimpleElement("link", link));
View Full Code Here

    protected Element generateLanguageElement(String language)
        throws FeedException {

        if (language == null) {
            throw new FeedException("invalid RSS Channel - missing required language element");
        } else {
            return generateSimpleElement("language", language);
        }
    }
View Full Code Here

        String title = image.getTitle();
        String url = image.getUrl();

        if (title == null) {
            throw new FeedException("invalid RSS Image - missing required title element");
        }
        if (url == null) {
            throw new FeedException("invalid RSS Image - missing required url element");
        }

        Element imageElement = new Element("image");
        imageElement.addContent(generateSimpleElement("title", title));
        imageElement.addContent(generateSimpleElement("url", url));
View Full Code Here

        String title = item.getTitle();
        String link = item.getLink();

        if (title == null) {
            throw new FeedException("invalid RSS Item - missing required title element");
        }
        if (link == null) {
            throw new FeedException("invalid RSS Item - missing required link element");
        }

        Element itemElement = new Element("item");
        itemElement.addContent(generateSimpleElement("title", title));
        itemElement.addContent(generateSimpleElement("link", link));
View Full Code Here

        String description = textInput.getDescription();
        String name = textInput.getName();
        String link = textInput.getLink();

        if (title == null) {
            throw new FeedException("invalid RSS TextInput - missing required title element");
        }
        if (description == null) {
            throw new FeedException("invalid RSS TextInput - missing required description element");
        }
        if (name == null) {
            throw new FeedException("invalid RSS TextInput - missing required name element");
        }
        if (link == null) {
            throw new FeedException("invalid RSS TextInput - missing required link element");
        }

        Element textInputElement = new Element("textInput");
        textInputElement.addContent(generateSimpleElement("title", title));
        textInputElement.addContent(generateDescriptionElement(textInput.getDescription()));
View Full Code Here

                try {
                    SAXBuilder saxBuilder = new SAXBuilder();
                    tmpDoc = saxBuilder.build(tmpDocReader);
                }
                catch (Exception ex) {
                    throw new FeedException("Invalid XML",ex);
                }
                List children = tmpDoc.getRootElement().removeContent();
                contentElement.addContent(children);
            } else {
                // must be type html, text or some other non-XML format
View Full Code Here

TOP

Related Classes of com.sun.syndication.io.FeedException

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.