类org.apache.commons.io.input.XmlStreamReader源码实例Demo

下面列出了怎么用org.apache.commons.io.input.XmlStreamReader的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: AntennaPodSP   文件: FeedHandler.java
public Feed parseFeed(Feed feed) throws SAXException, IOException,
        ParserConfigurationException, UnsupportedFeedtypeException {
    TypeGetter tg = new TypeGetter();
    TypeGetter.Type type = tg.getType(feed);
    SyndHandler handler = new SyndHandler(feed, type);

    SAXParserFactory factory = SAXParserFactory.newInstance();
    factory.setNamespaceAware(true);
    SAXParser saxParser = factory.newSAXParser();
    File file = new File(feed.getFile_url());
    Reader inputStreamReader = new XmlStreamReader(file);
    InputSource inputSource = new InputSource(inputStreamReader);

    saxParser.parse(inputSource, handler);
    inputStreamReader.close();
    return handler.state.feed;
}
 
源代码2 项目: LicenseScout   文件: MiscUtil.java
/**
 * Creates an XML InputSource from an InputStream with the correct
 * encoding.
 * 
 * @param inputStream
 * @return an input source for an XML parser
 * @throws IOException
 * 
 * @see {@link XmlStreamReader}
 */
public static InputSource getInputSource(final InputStream inputStream) throws IOException {
    final Reader reader = new XmlStreamReader(inputStream);
    return new InputSource(reader);
}
 
 类所在包
 类方法
 同包方法