} catch (URISyntaxException e) {
// Unexpected error, probably due to a programming error
throw new RuntimeException("Malformed url", e);
}
Document response;
try {
System.out.println("Reading feed from " + uri.toString());
response = client.contentAsDocument(new HttpGet(uri));
} catch (IOException e) {
throw new FeedReaderClientException("A connection error occurred while attempting to retrieve feed entries for URI " + uri.toString(), e);
} catch (IllegalArgumentException e) {
throw new FeedReaderClientException("Feedreader response was not valid XML from URI " + uri.toString(), e);
}
String rootNodeName = response.getRootNode().getName();
if (!rootNodeName.equals("feed") && !rootNodeName.equals("atom:feed")) {
throw new FeedReaderClientException("Feedreader reply does not contain feed root node: " + response.toString());
}
String namespace = "";
if (rootNodeName.startsWith("atom:")) {
namespace = "atom:";
}
List<FeedEntryWithSeqID> feedEntries = new ArrayList<FeedEntryWithSeqID>();
List<Node> entries = response.getRootNode().getChildNodes(namespace + "entry");
for (Node entry : entries) {
try {
long seqID = Long.valueOf(entry.getNode(namespace+"id").getContents());
URI documentURI = getLinkToDocumentOrIfDeletedLinkToEmptyDarwinRecordSet(namespace, entry);
String documentId = entry.getNode(namespace+"title").getContents();