2008-03-13 14:43:08 +01:00
|
|
|
/*
|
2008-03-14 11:24:18 +01:00
|
|
|
* Copyright 2008 National Library of Sweden
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2008-03-13 14:43:08 +01:00
|
|
|
*/
|
2008-03-14 11:24:18 +01:00
|
|
|
|
2008-03-13 14:43:08 +01:00
|
|
|
package se.kb.oai.pmh;
|
|
|
|
|
|
|
|
import java.util.LinkedList;
|
|
|
|
|
2008-03-14 11:24:18 +01:00
|
|
|
import org.dom4j.Document;
|
2008-03-13 14:43:08 +01:00
|
|
|
import org.dom4j.Node;
|
|
|
|
|
2008-03-14 16:45:59 +01:00
|
|
|
/**
|
|
|
|
* Class that represents the response from a <code>ListRecords</code> request.
|
2008-03-16 20:15:05 +01:00
|
|
|
* You can use it to get the list of <code>Records</code> that made up the
|
|
|
|
* response.
|
2008-03-14 16:45:59 +01:00
|
|
|
*
|
|
|
|
* @author Oskar Grenholm, National Library of Sweden
|
|
|
|
*/
|
2008-03-16 20:15:05 +01:00
|
|
|
public class RecordsList extends ListBase<Record> {
|
2008-03-13 14:43:08 +01:00
|
|
|
|
|
|
|
private static final String RECORD_XPATH = "oai:ListRecords/oai:record";
|
|
|
|
|
2008-03-14 16:45:59 +01:00
|
|
|
/**
|
|
|
|
* Creates a <code>RecordsList</code> from the returned response.
|
|
|
|
*
|
|
|
|
* @param document the response
|
|
|
|
* @throws ErrorResponseException
|
|
|
|
*/
|
2008-03-14 10:00:56 +01:00
|
|
|
public RecordsList(Document document) throws ErrorResponseException {
|
2008-03-13 14:43:08 +01:00
|
|
|
super(document);
|
|
|
|
|
2008-03-16 20:15:05 +01:00
|
|
|
super.list = new LinkedList<Record>();
|
2008-03-13 14:43:08 +01:00
|
|
|
for (Node record : xpath.selectNodes(RECORD_XPATH)) {
|
2008-03-16 20:15:05 +01:00
|
|
|
list.add(new Record(document, record));
|
|
|
|
}
|
|
|
|
}
|
2008-03-13 14:43:08 +01:00
|
|
|
}
|