citeproc-java supports several input file formats. This allows you to create citations and bibliographies from your existing citation databases.

Using the BibTeX converter

The library supports BibTeX databases. First, you have to load a BibTeX file as follows:

import de.undercouch.citeproc.bibtex.BibTeXConverter;
import org.jbibtex.BibTeXDatabase;

BibTeXDatabase db = new BibTeXConverter().loadDatabase(
    new FileInputStream("mydb.bib"));

After that, you can create an ItemDataProvider and pass it to the CSL processor.

import de.undercouch.citeproc.CSL;
import de.undercouch.citeproc.bibtex.BibTeXItemDataProvider;

BibTeXItemDataProvider provider = new BibTeXItemDataProvider();

CSL citeproc = new CSL(provider, "ieee");

Now, you can use the CSL processor as described on the getting started page. You can even call the registerCitationItems(CSL) method to generate a bibliography that contains all items from your BibTeX database.


Using the EndNote and RIS converters

Importing EndNote and RIS files works exactly like loading BibTeX databases. You just have to use the classes from the de.undercouch.citeproc.endnote or the de.undercouch.citeproc.ris package.

For EndNote, you may use the following code.

import de.undercouch.citeproc.CSL;
import de.undercouch.citeproc.endnote.EndNoteConverter;
import de.undercouch.citeproc.endnote.EndNoteItemDataProvider;
import de.undercouch.citeproc.endnote.EndNoteLibrary;

EndNoteLibrary lib = new EndNoteConverter().loadLibrary(
    new FileInputStream("mydb.enl"));

EndNoteItemDataProvider provider = new EndNoteItemDataProvider();

CSL citeproc = new CSL(provider, "ieee");

For RIS, use the following snippet.

import de.undercouch.citeproc.CSL;
import de.undercouch.citeproc.ris.RISConverter;
import de.undercouch.citeproc.ris.RISItemDataProvider;
import de.undercouch.citeproc.ris.RISLibrary;

RISLibrary lib = new RISConverter().loadLibrary(
    new FileInputStream("mydb.ris"));

RISItemDataProvider provider = new RISItemDataProvider();

CSL citeproc = new CSL(provider, "ieee");