Search in sources :

Example 1 with RecordStack

use of org.marc4j.RecordStack in project RecordManager2 by moravianlibrary.

the class MarcXmlParserImpl method parseUnderlyingRecord.

@Override
public Record parseUnderlyingRecord(InputStream is) {
    try {
        RecordStack queue = new RecordStack();
        MarcXmlHandler handler = new MarcXmlHandler(queue);
        org.marc4j.MarcXmlParser parser = new org.marc4j.MarcXmlParser(handler);
        parser.parse(new InputSource(is));
        return queue.pop();
    } catch (org.marc4j.MarcException me) {
        throw new InvalidMarcException(me.getMessage(), me);
    }
}
Also used : RecordStack(org.marc4j.RecordStack) InputSource(org.xml.sax.InputSource) MarcXmlHandler(cz.mzk.recordmanager.server.marc.marc4j.MarcXmlHandler)

Example 2 with RecordStack

use of org.marc4j.RecordStack in project RecordManager2 by moravianlibrary.

the class MarcXmlParserImpl method parseRecord.

@Override
public MarcRecord parseRecord(InputStream is) {
    try {
        RecordStack queue = new RecordStack();
        MarcXmlHandler handler = new MarcXmlHandler(queue);
        org.marc4j.MarcXmlParser parser = new org.marc4j.MarcXmlParser(handler);
        parser.parse(new InputSource(is));
        Record record = queue.pop();
        return new MarcRecordImpl(record);
    } catch (org.marc4j.MarcException me) {
        throw new InvalidMarcException(me.getMessage(), me);
    }
}
Also used : RecordStack(org.marc4j.RecordStack) InputSource(org.xml.sax.InputSource) MarcXmlHandler(cz.mzk.recordmanager.server.marc.marc4j.MarcXmlHandler) HarvestedRecord(cz.mzk.recordmanager.server.model.HarvestedRecord) Record(org.marc4j.marc.Record)

Aggregations

MarcXmlHandler (cz.mzk.recordmanager.server.marc.marc4j.MarcXmlHandler)2 RecordStack (org.marc4j.RecordStack)2 InputSource (org.xml.sax.InputSource)2 HarvestedRecord (cz.mzk.recordmanager.server.model.HarvestedRecord)1 Record (org.marc4j.marc.Record)1