Closed GoogleCodeExporter closed 9 years ago
Resolver Support added.
now you can plugin xmlcatalog as follows:
{{{
import org.apache.xml.resolver.Catalog;
import org.apache.xml.resolver.CatalogManager;
class CrawlerCatalogResolver implements XMLCrawler.Resolver{
public CrawlerCatalogResolver(){
CatalogManager.getStaticManager().setCatalogFiles("/Users/santhosh/Downloads/XmlCrawler-catalog-test/crawl-files/testLocalImportCatalog-catalog.xml");
}
@Override
public String resolve(String namespace, String base, String location){
Catalog catalog = CatalogManager.getStaticManager().getCatalog();
String uri = URLUtil.toURI(base).resolve(location).toString();
try{
String result = catalog.resolveURI(uri);
if(result!=null)
return result;
}catch(Exception ignore){
// ignore
}
try{
String result = catalog.resolvePublic(namespace, uri);
if(result!=null)
return result;
}catch(Exception e){
e.printStackTrace();
}
return null;
}
}
}}}
and set above resolver in xmlcrawler as follows:
{{{
XMLCrawler xmlCrawler = new XMLCrawler();
xmlCrawler.setResolver(new CrawlerCatalogResolver());
}}}
Original comment by santhosh.tekuri@gmail.com
on 3 May 2013 at 8:05
the fix is done in r1764
Original comment by santhosh.tekuri@gmail.com
on 3 May 2013 at 8:20
Original issue reported on code.google.com by
niels...@gmail.com
on 21 Apr 2013 at 2:59Attachments: