Package org.marc4j.marc

Examples of org.marc4j.marc.Record


        InputStream input = ReadMarcExample.class
                .getResourceAsStream("resources/chabon.mrc");

        MarcReader reader = new MarcStreamReader(input);
        while (reader.hasNext()) {
            Record record = reader.next();
           
            // get control field with tag 008
            ControlField controlField = (ControlField) record
                    .getVariableField("008");
           
            String data = controlField.getData();

            // the three-character MARC language code takes character
View Full Code Here


    public Subfield newSubfield(char code, String data) {
        return new SubfieldImpl(code, data);
    }

    public Record newRecord(Leader leader) {
        Record record = new RecordImpl();
        record.setLeader(leader);
        return record;
    }
View Full Code Here

        InputStream input = ReadSingleRecordExample.class
                .getResourceAsStream("resources/summerland.mrc");

        MarcReader reader = new MarcStreamReader(input);
        Record record = reader.next();
        System.out.println(record.toString());
    }
View Full Code Here

        int i = 0;
        InputStream input = getClass().getResourceAsStream(
                "resources/chabon.mrc");
        MarcStreamReader reader = new MarcStreamReader(input);
        while (reader.hasNext()) {
            Record record = reader.next();
            System.err.println(record.toString());
            i++;
        }
        input.close();
        assertEquals(2, i);
    }
View Full Code Here

                .getResourceAsStream("resources/error.mrc");

        try {
            MarcReader reader = new MarcStreamReader(input);
            while (reader.hasNext()) {
                Record record = reader.next();
                System.out.println(record.toString());
            }
        } catch (MarcException e) {
            System.out.println("something went wrong man!");

        }
View Full Code Here

        int i = 0;
        InputStream input = getClass().getResourceAsStream(
                "resources/chabon.xml");
        MarcXmlReader reader = new MarcXmlReader(input);
        while (reader.hasNext()) {
            Record record = reader.next();
            System.err.println(record.toString());
            i++;
        }
        input.close();
        assertEquals(2, i);
    }
View Full Code Here

        if (normalize)
            writer.setUnicodeNormalization(true);

        while (reader.hasNext()) {
            Record record = reader.next();
            if (Constants.MARC_8_ENCODING.equals(convert))
                record.getLeader().setCharCodingScheme('a');
            writer.write(record);
        }
        writer.close();

        System.err.println("Total time: "
View Full Code Here

        MarcReader reader = new MarcXmlReader(input,
                "http://www.loc.gov/standards/marcxml/xslt/MODS2MARC21slim.xsl");

        while (reader.hasNext()) {
            Record record = reader.next();
            System.out.println(record.toString());

        }
    }
View Full Code Here

        MarcFactory factory = MarcFactory.newInstance();

        MarcReader reader = new MarcStreamReader(input);
        while (reader.hasNext()) {
            Record record = reader.next();

            DataField field = factory.newDataField("856", '4', '2');
            field.addSubfield(factory.newSubfield('3',
                "Contributor biographical information"));
            field.addSubfield(factory.newSubfield('u',
                "http://en.wikipedia.org/wiki/Michael_Chabon"));
            record.addVariableField(field);

            System.out.println(record.toString());
        }

    }
View Full Code Here

        InputStream input = ReadMarcExample.class
                .getResourceAsStream("resources/summerland.mrc");

        MarcReader reader = new MarcStreamReader(input);
        while (reader.hasNext()) {
            Record record = reader.next();
            System.out.println(record.toString());
        }

    }
View Full Code Here

TOP

Related Classes of org.marc4j.marc.Record

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.