if (name.equals("Citation")) {
// redefinition of citation so clear out citation context
citationContext = null;
if (list == null) {
addError(new InvalidCitationException(an.getLine(), an.getCharPositionInLine()));
} else {
String listvalues = list.getText();
String[] tokens = ParserUtil.parseListRecord(listvalues);
String type = null;
String cname = null;
String reference = null;
Date publicationDate = null;
String[] authors = null;
String comment = null;
// (required) parse type
if (tokens.length > 0 && tokens[0] != null) {
type = tokens[0];
if (!("Book".equals(type) || "Journal".equals(type) || "Online Resource".equals(type) || "Other".equals(type) || "PubMed".equals(type))) {
addError(new InvalidCitationException(an.getLine(), an.getCharPositionInLine()));
}
} else {
addError(new InvalidCitationException(an.getLine(), an.getCharPositionInLine()));
}
// (required) parse name
if (tokens.length > 1 && tokens[1] != null) {
if ("".equals(tokens[1].trim())) {
addError(new InvalidCitationException(an.getLine(), an.getCharPositionInLine()));
} else {
cname = tokens[1];
}
} else {
addError(new InvalidCitationException(an.getLine(), an.getCharPositionInLine()));
}
// (required) parse reference
if (tokens.length > 2 && tokens[2] != null) {
if ("".equals(tokens[2].trim())) {
addError(new InvalidCitationException(an.getLine(), an.getCharPositionInLine()));
} else {
reference = tokens[2];
}
}
// (optional) parse date of publication
if (tokens.length > 3 && tokens[3] != null) {
if (!"".equals(tokens[3].trim())) {
try {
publicationDate = iso8601DateFormat.parse(tokens[3]);
} catch (ParseException e) {
addError(new InvalidCitationException(an.getLine(), an.getCharPositionInLine()));
}
if (publicationDate == null) {
addError(new InvalidCitationException(an.getLine(), an.getCharPositionInLine()));
}
}
}
// (optional) parse authors