Search in sources :

Example 1 with BibtexFile

use of bibtex.dom.BibtexFile in project mycore by MyCoRe-Org.

the class MCRBibTeX2MODSTransformer method transform.

@Override
public MCRJDOMContent transform(MCRContent source) throws IOException {
    String input = source.asString();
    input = fixMissingEntryKeys(input);
    BibtexFile bibtexFile = parse(input);
    Element collection = new MCRBibTeXFileTransformer().transform(bibtexFile);
    return new MCRJDOMContent(collection);
}
Also used : BibtexFile(bibtex.dom.BibtexFile) Element(org.jdom2.Element) MCRJDOMContent(org.mycore.common.content.MCRJDOMContent)

Example 2 with BibtexFile

use of bibtex.dom.BibtexFile in project mycore by MyCoRe-Org.

the class MCRBibTeX2MODSTransformer method parse.

private BibtexFile parse(String input) throws IOException {
    BibtexFile bibtexFile = new BibtexFile();
    BibtexParser parser = new BibtexParser(false);
    parser.setMultipleFieldValuesPolicy(BibtexMultipleFieldValuesPolicy.KEEP_ALL);
    try {
        parser.parse(bibtexFile, new StringReader(input));
    } catch (ParseException ex) {
        MCRMessageLogger.logMessage(ex.toString());
    }
    return bibtexFile;
}
Also used : BibtexFile(bibtex.dom.BibtexFile) BibtexParser(bibtex.parser.BibtexParser) StringReader(java.io.StringReader) ParseException(bibtex.parser.ParseException)

Aggregations

BibtexFile (bibtex.dom.BibtexFile)2 BibtexParser (bibtex.parser.BibtexParser)1 ParseException (bibtex.parser.ParseException)1 StringReader (java.io.StringReader)1 Element (org.jdom2.Element)1 MCRJDOMContent (org.mycore.common.content.MCRJDOMContent)1