在浏览器中手动查询得到1305个结果: http ://www.gahetna.nl/beeldbank-api/opensearch/?q=Leiden
但是我的 Abdera 代码(如下)只返回 19 个结果。这一定是由于分页。如何访问结果的所有页面?谢谢!
List<NationaalArchiefDoc> docs = new ArrayList();
Abdera abdera = new Abdera();
AbderaClient client = new AbderaClient(abdera);
searchString = searchString.replaceAll(" ", "+");
ClientResponse resp = client.get("http://www.gahetna.nl/beeldbank-api/opensearch/?q=" + searchString.trim());
if (resp.getType() == ResponseType.SUCCESS) {
Document docAbdera = resp.getDocument();
Element elementAbdera = docAbdera.getRoot();
Iterator<Element> elementIterator = elementAbdera.getElements().get(0).getElements().iterator();
System.out.println("number of docs found: " + elementAbdera.getElements().get(0).getElements().size());
//looping through the 19 items
while (elementIterator.hasNext()) {
NationaalArchiefDoc doc = new NationaalArchiefDoc();
Element element1 = elementIterator.next();
// more actions in the loop...
}
}