我正在使用org.jbibtex(Java BibTex)来解析citeproc-Java Library的BibeTex文件。我得到以下例外:
Encountered " "," ", "" at line 7, column 2.
Was expecting one of:
<EOF>
以下re文件条目属于基于 zotero 的bib文件
@book{arxiv.org_65_2007,
title = {65 Admin Withdrawals},
author = {{arXiv.org}},
year = {2007},
note = {Published: Online Source
Retrieved}
},
@book{american_national_standards_institute_ansi_1986,
title = {{ANSI} X3.4-1986 - American National Standard for Information Systems — Coded Character Sets — 7-Bit American National Standard Code for Information Interchange (7-Bit {ASCII)}},
author = {American National Standards Institute, Inc.},
year = {1986},
note = {Published: Standard (withdrawn Oct 11 1994, incoporated into Unicode Standard)}
}
我可以看到它在逗号上出错,但我相信这是bib格式的一部分,我不太清楚。以下是我的代码:
String s = null;
BibTeXConverter bibC = new BibTeXConverter();
try
{
BibTeXDatabase db = bibC.loadDatabase(new FileInputStream("C:\\zotero.bib"));
BibTeXItemDataProvider provider = new BibTeXItemDataProvider();
provider.addDatabase(db);
CSL citeproc = new CSL(provider, "ieee");
citeproc.setOutputFormat("text");
provider.registerCitationItems(citeproc);
Bibliography bibl = citeproc.makeBibliography();
System.out.println(bibl.makeString());
for (String entry : bibl.getEntries()) {
System.out.println(entry);
s+=s+entry+"\n";
}
}
catch(Exception ex)
{
System.out.println(ex.getMessage());
}