当前位置: 首页>>代码示例>>Java>>正文


Java WireFeed类代码示例

本文整理汇总了Java中com.sun.syndication.feed.WireFeed的典型用法代码示例。如果您正苦于以下问题:Java WireFeed类的具体用法?Java WireFeed怎么用?Java WireFeed使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WireFeed类属于com.sun.syndication.feed包,在下文中一共展示了WireFeed类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseChannel

import com.sun.syndication.feed.WireFeed; //导入依赖的package包/类
protected WireFeed parseChannel(Element rssRoot)  {
    Channel channel = (Channel) super.parseChannel(rssRoot);
    Element eChannel = rssRoot.getChild("channel",getRSSNamespace());

    List eCats = eChannel.getChildren("category",getRSSNamespace());
    channel.setCategories(parseCategories(eCats));

    Element eTtl = eChannel.getChild("ttl",getRSSNamespace());
    if (eTtl!=null) {
        Integer ttlValue = new Integer(eTtl.getText());
        if (ttlValue != null) {
            channel.setTtl(ttlValue.intValue());
        }
    }

    return channel;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:18,代码来源:RSS094Parser.java

示例2: copyInto

import com.sun.syndication.feed.WireFeed; //导入依赖的package包/类
public void copyInto(WireFeed feed,SyndFeed syndFeed) {
    syndFeed.setModules(ModuleUtils.cloneModules(feed.getModules()));

    syndFeed.setEncoding(feed.getEncoding());
    Channel channel = (Channel) feed;
    syndFeed.setTitle(channel.getTitle());
    syndFeed.setLink(channel.getLink());
    syndFeed.setDescription(channel.getDescription());

    Image image = channel.getImage();
    if (image!=null) {
        syndFeed.setImage(createSyndImage(image));
    }

    List items = channel.getItems();
    if (items!=null) {
        syndFeed.setEntries(createSyndEntries(items));
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:ConverterForRSS090.java

示例3: createRealFeed

import com.sun.syndication.feed.WireFeed; //导入依赖的package包/类
protected WireFeed createRealFeed(String type,SyndFeed syndFeed) {
    Channel channel = new Channel(type);
    channel.setModules(ModuleUtils.cloneModules(syndFeed.getModules()));

    channel.setEncoding(syndFeed.getEncoding());

    channel.setTitle(syndFeed.getTitle());
    channel.setLink(syndFeed.getLink());
    channel.setDescription(syndFeed.getDescription());
    SyndImage sImage = syndFeed.getImage();
    if (sImage!=null) {
        channel.setImage(createRSSImage(sImage));
    }

    List sEntries = syndFeed.getEntries();
    if (sEntries!=null) {
        channel.setItems(createRSSItems(sEntries));
    }
    return channel;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:ConverterForRSS090.java

示例4: copyInto

import com.sun.syndication.feed.WireFeed; //导入依赖的package包/类
public void copyInto(WireFeed feed,SyndFeed syndFeed) {
    Channel channel = (Channel) feed;
    super.copyInto(channel,syndFeed);
    syndFeed.setLanguage(channel.getLanguage());        //c
    syndFeed.setCopyright(channel.getCopyright());      //c
    Date pubDate = channel.getPubDate();
    if (pubDate!=null) {
        syndFeed.setPublishedDate(pubDate);     //c
    }

    String author = channel.getManagingEditor();
    if (author!=null) {    
        List creators = ((DCModule) syndFeed.getModule(DCModule.URI)).getCreators();
        if (!creators.contains(author)) {
            Set s = new HashSet(); // using a set to remove duplicates
            s.addAll(creators);    // DC creators
            s.add(author);         // feed native author
            creators.clear();
            creators.addAll(s);
        }
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:ConverterForRSS091Userland.java

示例5: parseChannel

import com.sun.syndication.feed.WireFeed; //导入依赖的package包/类
protected WireFeed parseChannel(Element rssRoot)  {
    Channel channel = (Channel) super.parseChannel(rssRoot);

    Element eChannel = rssRoot.getChild("channel",getRSSNamespace());
    Element eCloud = eChannel.getChild("cloud",getRSSNamespace());
    if (eCloud!=null) {
        Cloud cloud = new Cloud();
        String att = eCloud.getAttributeValue("domain");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
        if (att!=null) {
            cloud.setDomain(att);
        }
        att = eCloud.getAttributeValue("port");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
        if (att!=null) {
            cloud.setPort(Integer.parseInt(att));
        }
        att = eCloud.getAttributeValue("path");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
        if (att!=null) {
            cloud.setPath(att);
        }
        att = eCloud.getAttributeValue("registerProcedure");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
        if (att!=null) {
            cloud.setRegisterProcedure(att);
        }
        att = eCloud.getAttributeValue("protocol");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
        if (att!=null) {
            cloud.setProtocol(att);
        }
        channel.setCloud(cloud);
    }
    return channel;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:32,代码来源:RSS092Parser.java

示例6: parseChannel

import com.sun.syndication.feed.WireFeed; //导入依赖的package包/类
protected WireFeed parseChannel(Element rssRoot) {
    Channel channel = (Channel) super.parseChannel(rssRoot);

    Element eChannel = rssRoot.getChild("channel", getRSSNamespace());
    String uri = eChannel.getAttributeValue("about", getRDFNamespace());
    if (uri != null) {
        channel.setUri(uri);
    }

    return channel;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:RSS10Parser.java

示例7: main

import com.sun.syndication.feed.WireFeed; //导入依赖的package包/类
public static void main(String[] args) {
    boolean ok = false;
    if (args.length==1) {
        try {
            URL feedUrl = new URL(args[0]);
            WireFeedInput input = new WireFeedInput();

            WireFeed feed = input.build(new XmlReader(feedUrl));

            System.out.println(feed);

            ok = true;
        }
        catch (Exception ex) {
            ex.printStackTrace();
            System.out.println("ERROR: "+ex.getMessage());
        }
    }

    if (!ok) {
        System.out.println();
        System.out.println("WireFeedReader reads and prints any RSS/Atom feed type.");
        System.out.println("The first parameter must be the URL of the feed to read.");
        System.out.println();
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:27,代码来源:WireFeedReader.java

示例8: SyndFeedImpl

import com.sun.syndication.feed.WireFeed; //导入依赖的package包/类
/**
 * Creates a SyndFeedImpl and populates all its properties out of the
 * given RSS Channel or Atom Feed properties, while optionally preserving
 * the WireFeed for access via the orignalWireFeed() method.
 * 
 * @param feed
 * @param preserveWireFeed
 */
public SyndFeedImpl(WireFeed feed, boolean preserveWireFeed) {    	
    this(SyndFeed.class,IGNORE_PROPERTIES);

	if (preserveWireFeed) {    		
		this.wireFeed = feed;
		this.preserveWireFeed = preserveWireFeed;
	}
            
    if (feed!=null) {
        _feedType = feed.getFeedType();
        Converter converter = CONVERTERS.getConverter(_feedType);
        if (converter==null) {
            throw new IllegalArgumentException("Invalid feed type ["+_feedType+"]");
        }
        converter.copyInto(feed,this);
    }
    
}
 
开发者ID:4thline,项目名称:feeds,代码行数:27,代码来源:SyndFeedImpl.java

示例9: copyInto

import com.sun.syndication.feed.WireFeed; //导入依赖的package包/类
public void copyInto(WireFeed feed,SyndFeed syndFeed) {
    syndFeed.setModules(ModuleUtils.cloneModules(feed.getModules()));
    if (((List)feed.getForeignMarkup()).size() > 0) {
        syndFeed.setForeignMarkup(feed.getForeignMarkup());
    }
    syndFeed.setEncoding(feed.getEncoding());
    Channel channel = (Channel) feed;
    syndFeed.setTitle(channel.getTitle());
    syndFeed.setLink(channel.getLink());
    syndFeed.setDescription(channel.getDescription());

    Image image = channel.getImage();
    if (image!=null) {
        syndFeed.setImage(createSyndImage(image));
    }

    List items = channel.getItems();
    if (items!=null) {
        syndFeed.setEntries(createSyndEntries(items, syndFeed.isPreservingWireFeed()));
    }
}
 
开发者ID:4thline,项目名称:feeds,代码行数:22,代码来源:ConverterForRSS090.java

示例10: createRealFeed

import com.sun.syndication.feed.WireFeed; //导入依赖的package包/类
@Override
protected WireFeed createRealFeed(String type, SyndFeed syndFeed) {
    Channel channel = (Channel) super.createRealFeed(type, syndFeed);
    channel.setLanguage(syndFeed.getLanguage()); //c
    channel.setCopyright(syndFeed.getCopyright()); //c
    channel.setPubDate(syndFeed.getPublishedDate()); //c        

    if ((syndFeed.getAuthors() != null) && (syndFeed.getAuthors()
                                                        .size() > 0)) {
        SyndPerson author = (SyndPerson) syndFeed.getAuthors()
                                                 .get(0);
        channel.setManagingEditor(author.getName());
    }

    return channel;
}
 
开发者ID:4thline,项目名称:feeds,代码行数:17,代码来源:ConverterForRSS091Userland.java

示例11: parseChannel

import com.sun.syndication.feed.WireFeed; //导入依赖的package包/类
protected WireFeed parseChannel(Element rssRoot)  {
    Channel channel = (Channel) super.parseChannel(rssRoot);
    Element eChannel = rssRoot.getChild("channel",getRSSNamespace());

    List eCats = eChannel.getChildren("category",getRSSNamespace());
    channel.setCategories(parseCategories(eCats));

    Element eTtl = eChannel.getChild("ttl",getRSSNamespace());
    if (eTtl!=null && eTtl.getText() != null ) {
        Integer ttlValue = null;        
        try{
             ttlValue = new Integer(eTtl.getText());
        } catch(NumberFormatException nfe ){ 
            ; //let it go by
        }
        if (ttlValue != null) {
            channel.setTtl(ttlValue.intValue());
        }
    }

    return channel;
}
 
开发者ID:4thline,项目名称:feeds,代码行数:23,代码来源:RSS094Parser.java

示例12: parse

import com.sun.syndication.feed.WireFeed; //导入依赖的package包/类
/**
 * Parses the data from the supplied InputStream, using the supplied baseURI
 * to resolve any relative URI references.
 *
 * @param in      The InputStream from which to read the data.
 * @param baseURI The URI associated with the data in the InputStream.
 * @throws java.io.IOException If an I/O error occurred while data was read from the InputStream.
 * @throws org.openrdf.rio.RDFParseException
 *                             If the parser has found an unrecoverable parse error.
 * @throws org.openrdf.rio.RDFHandlerException
 *                             If the configured statement handler has encountered an
 *                             unrecoverable error.
 */
@Override
public void parse(InputStream in, String baseURI) throws IOException, RDFParseException, RDFHandlerException {
    Preconditions.checkNotNull(baseURI);

    setBaseURI(baseURI);

    WireFeedInput input = new WireFeedInput();
    try {
        WireFeed feed = input.build(new InputSource(in));
        if(feed instanceof Channel) {
            parseFeed((Channel) feed);
        } else {
            throw new RDFParseException("data stream is not an RSS feed");
        }
    } catch (FeedException e) {
        throw new RDFParseException(e);
    }
}
 
开发者ID:apache,项目名称:marmotta,代码行数:32,代码来源:RSSParser.java

示例13: parse

import com.sun.syndication.feed.WireFeed; //导入依赖的package包/类
/**
 * Parses the data from the supplied InputStream, using the supplied baseURI
 * to resolve any relative URI references.
 *
 * @param in      The InputStream from which to read the data.
 * @param baseURI The URI associated with the data in the InputStream.
 * @throws java.io.IOException If an I/O error occurred while data was read from the InputStream.
 * @throws org.openrdf.rio.RDFParseException
 *                             If the parser has found an unrecoverable parse error.
 * @throws org.openrdf.rio.RDFHandlerException
 *                             If the configured statement handler has encountered an
 *                             unrecoverable error.
 */
@Override
public void parse(InputStream in, String baseURI) throws IOException, RDFParseException, RDFHandlerException {
    Preconditions.checkNotNull(baseURI);

    setBaseURI(baseURI);

    WireFeedInput input = new WireFeedInput();
    try {
        WireFeed feed = input.build(new InputSource(in));
        if(feed instanceof Feed) {
            parseFeed((Feed) feed);
        } else {
            throw new RDFParseException("data stream is not an RSS feed");
        }
    } catch (FeedException e) {
        throw new RDFParseException(e);
    }
}
 
开发者ID:apache,项目名称:marmotta,代码行数:32,代码来源:AtomParser.java

示例14: copyInto

import com.sun.syndication.feed.WireFeed; //导入依赖的package包/类
public void copyInto(WireFeed feed,SyndFeed syndFeed) {
    syndFeed.setModules(ModuleUtils.cloneModules(feed.getModules()));
    if (((List)feed.getForeignMarkup()).size() > 0) {
        syndFeed.setForeignMarkup(feed.getForeignMarkup());
    }
    syndFeed.setEncoding(feed.getEncoding());
    Channel channel = (Channel) feed;
    syndFeed.setTitle(channel.getTitle());
    syndFeed.setLink(channel.getLink());
    syndFeed.setDescription(channel.getDescription());

    Image image = channel.getImage();
    if (image!=null) {
        syndFeed.setImage(createSyndImage(image));
    }

    List items = channel.getItems();
    if (items!=null) {
        syndFeed.setEntries(createSyndEntries(items));
    }
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:22,代码来源:ConverterForRSS090.java

示例15: copyInto

import com.sun.syndication.feed.WireFeed; //导入依赖的package包/类
public void copyInto(WireFeed feed,SyndFeed syndFeed) {
    Channel channel = (Channel) feed;
    super.copyInto(channel,syndFeed);
    syndFeed.setLanguage(channel.getLanguage());        //c
    syndFeed.setCopyright(channel.getCopyright());      //c
    Date pubDate = channel.getPubDate();
    if (pubDate!=null) {
        syndFeed.setPublishedDate(pubDate);  //c
    } else if (channel.getLastBuildDate() != null) {
        syndFeed.setPublishedDate(channel.getLastBuildDate());  //c
    }
    

    String author = channel.getManagingEditor();
    if (author!=null) {    
        List creators = ((DCModule) syndFeed.getModule(DCModule.URI)).getCreators();
        if (!creators.contains(author)) {
            Set s = new HashSet(); // using a set to remove duplicates
            s.addAll(creators);    // DC creators
            s.add(author);         // feed native author
            creators.clear();
            creators.addAll(s);
        }
    }

}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:27,代码来源:ConverterForRSS091Userland.java


注:本文中的com.sun.syndication.feed.WireFeed类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。