final NamedNodeMap attributes = doc.getAttributes();
final String url = attributes.getNamedItem("href").getNodeValue();
if("".equals(url)){
return 0;
}
Bookmark bm;
try {
bm = db.new Bookmark(url);
} catch (final MalformedURLException e1) {
return 0;
}
String tagsString = "";
String title = "";
String description = "";
String time = "";
if(attributes.getNamedItem("tag") != null){
tagsString = attributes.getNamedItem("tag").getNodeValue();
}
if(attributes.getNamedItem("description") != null){
title = attributes.getNamedItem("description").getNodeValue();
}
if(attributes.getNamedItem("extended") != null){
description = attributes.getNamedItem("extended").getNodeValue();
}
if(attributes.getNamedItem("time") != null){
time = attributes.getNamedItem("time").getNodeValue();
}
Set<String> tags = new HashSet<String>();
if (title != null) {
bm.setProperty(Bookmark.BOOKMARK_TITLE, title);
}
if (tagsString != null) {
tags = ListManager.string2set(tagsString.replace(' ', ','));
}
bm.setTags(tags, true);
if(time != null){
Date parsedDate = null;
try {
parsedDate = ISO8601Formatter.FORMATTER.parse(time);
} catch (final ParseException e) {
parsedDate = new Date();
}
bm.setTimeStamp(parsedDate.getTime());
}
if(description!=null){
bm.setProperty(Bookmark.BOOKMARK_DESCRIPTION, description);
}
bm.setPublic(importPublic);
db.saveBookmark(bm);
importCount++;
}
final NodeList children=doc.getChildNodes();