use of org.codelibs.fess.crawler.exception.SitemapsException in project fess-crawler by codelibs.
the class SitemapsHelper method parseTextSitemaps.
protected SitemapSet parseTextSitemaps(final InputStream in) {
final SitemapSet sitemapSet = new SitemapSet();
sitemapSet.setType(SitemapSet.URLSET);
try {
final BufferedReader br = new BufferedReader(new InputStreamReader(in, Constants.UTF_8));
String line;
while ((line = br.readLine()) != null) {
final String url = line.trim();
if (StringUtil.isNotBlank(url) && (url.startsWith("http://") || url.startsWith("https://"))) {
final SitemapUrl sitemapUrl = new SitemapUrl();
sitemapUrl.setLoc(url);
sitemapSet.addSitemap(sitemapUrl);
}
}
return sitemapSet;
} catch (final Exception e) {
throw new SitemapsException("Could not parse Text Sitemaps.", e);
}
}
use of org.codelibs.fess.crawler.exception.SitemapsException in project fess-crawler by codelibs.
the class SitemapsHelper method parseXmlSitemaps.
protected SitemapSet parseXmlSitemaps(final InputStream in) {
final XmlSitemapsHandler handler = new XmlSitemapsHandler();
try {
final SAXParserFactory spfactory = SAXParserFactory.newInstance();
final SAXParser parser = spfactory.newSAXParser();
parser.parse(in, handler);
} catch (final Exception e) {
throw new SitemapsException("Could not parse XML Sitemaps.", e);
}
return handler.getSitemapSet();
}
use of org.codelibs.fess.crawler.exception.SitemapsException in project fess-crawler by codelibs.
the class SitemapsHelper method parseXmlSitemapsIndex.
protected SitemapSet parseXmlSitemapsIndex(final InputStream in) {
final XmlSitemapsIndexHandler handler = new XmlSitemapsIndexHandler();
try {
final SAXParserFactory spfactory = SAXParserFactory.newInstance();
final SAXParser parser = spfactory.newSAXParser();
parser.parse(in, handler);
} catch (final Exception e) {
throw new SitemapsException("Could not parse XML Sitemaps Index.", e);
}
return handler.getSitemapSet();
}
Aggregations