From: Dennis Schafroth Date: Wed, 4 Jan 2012 19:16:03 +0000 (+0100) Subject: Setting MARC-8 on reader, not writer. Set to skip bad indicator X-Git-Tag: v2.5~23^2~19 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=6c852dd2a2fac370378f3f167917d0561abc65ef;p=marc4j.git Setting MARC-8 on reader, not writer. Set to skip bad indicator --- diff --git a/src/org/marc4j/samples/Marc8ToMarcXmlExample.java b/src/org/marc4j/samples/Marc8ToMarcXmlExample.java index 9bf6b06..f462819 100644 --- a/src/org/marc4j/samples/Marc8ToMarcXmlExample.java +++ b/src/org/marc4j/samples/Marc8ToMarcXmlExample.java @@ -25,11 +25,9 @@ import java.io.FileInputStream; import java.io.InputStream; import java.io.OutputStream; -import org.marc4j.MarcReader; import org.marc4j.MarcStreamReader; import org.marc4j.MarcWriter; import org.marc4j.MarcXmlWriter; -import org.marc4j.converter.impl.AnselToUnicode; import org.marc4j.marc.Record; /** @@ -42,19 +40,22 @@ public class Marc8ToMarcXmlExample { public static void main(String args[]) throws Exception { InputStream input; - if (args.length > 0) + if (args.length > 0) { input = new FileInputStream(new File(args[0])); + } else input = ReadMarcExample.class .getResourceAsStream("resources/brkrtest.mrc"); OutputStream out = System.out; - MarcReader reader = new MarcStreamReader(input); + MarcStreamReader reader = new MarcStreamReader(input, "MARC-8"); + // Do not set bad indicators + reader.setBadIndicators(false); MarcWriter writer = new MarcXmlWriter(out, true); - AnselToUnicode converter = new AnselToUnicode(); - writer.setConverter(converter); + //AnselToUnicode converter = new AnselToUnicode(); + //writer.setConverter(converter); while (reader.hasNext()) { Record record = reader.next();