Package org.marc4j.marc

Examples of org.marc4j.marc.Record


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

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

            // check if the cataloging agency is DLC
            List result = record.find("040", "DLC");
            if (result.size() > 0)
                System.out.println("Agency for this record is DLC");

            // there is no specific find for a specific subfield
            // so to check if it is the orignal cataloging agency
View Full Code Here


        DOMResult result = new DOMResult();
        MarcXmlWriter writer = new MarcXmlWriter(result);
        writer.setConverter(new AnselToUnicode());
        while (reader.hasNext()) {
            Record record = (Record) reader.next();
            writer.write(record);
        }
        writer.close();

        Document doc = (Document) result.getNode();
View Full Code Here

        String systemId = "http://www.loc.gov/standards/marcxml/Sandburg/sandburg.xml";
        InputSource input = new InputSource(systemId);

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

    }
View Full Code Here

        InputStream input = getClass().getResourceAsStream(
                "resources/summerland.xml");
        MarcStreamWriter writer = new MarcStreamWriter(System.out);
        MarcXmlReader reader = new MarcXmlReader(input);
        while (reader.hasNext()) {
            Record record = reader.next();
            writer.write(record);
        }
        input.close();
        writer.close();
    }
View Full Code Here

        InputStream input = getClass().getResourceAsStream(
                "resources/summerland.mrc");
        MarcXmlWriter writer = new MarcXmlWriter(System.out, true);
        MarcStreamReader reader = new MarcStreamReader(input);
        while (reader.hasNext()) {
            Record record = reader.next();
            writer.write(record);
        }
        input.close();
        writer.close();
    }
View Full Code Here

                "resources/summerland.xml");
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        MarcStreamWriter writer = new MarcStreamWriter(out);
        MarcXmlReader reader = new MarcXmlReader(input);
        while (reader.hasNext()) {
            Record record = reader.next();
            writer.write(record);
        }
        input.close();
        writer.close();

        ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
        MarcStreamReader marcReader = new MarcStreamReader(in);
        MarcStreamWriter marcWriter = new MarcStreamWriter(System.out);
        while (marcReader.hasNext()) {
            Record record = marcReader.next();
            marcWriter.write(record);
        }
        in.close();
        marcWriter.close();
View Full Code Here

        AnselToUnicode converter = new AnselToUnicode();
        writer.setConverter(converter);

        while (reader.hasNext()) {
            Record record = reader.next();
            writer.write(record);
        }
        writer.close();
    }
View Full Code Here

        InputStream input = PersonalNamesExample.class
                .getResourceAsStream("resources/names.txt");

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

    }
View Full Code Here

        int i = 0;
        InputStream input = getClass().getResourceAsStream(
        "resources/bad_leaders_10_11.mrc");
        MarcReader reader = new MarcPermissiveStreamReader(input, true, true);
        while (reader.hasNext()) {
            Record record = reader.next();

            assertEquals(2, record.getLeader().getIndicatorCount());
            assertEquals(2, record.getLeader().getSubfieldCodeLength());
            i++;
        }
        input.close();
        assertEquals(1, i);
    }
View Full Code Here

        AnselToUnicode converter = new AnselToUnicode();
        writer.setConverter(converter);

        while (reader.hasNext()) {
            Record record = reader.next();
            writer.write(record);
        }
        writer.close();
    }
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.