From 6c852dd2a2fac370378f3f167917d0561abc65ef Mon Sep 17 00:00:00 2001 From: Dennis Schafroth Date: Wed, 4 Jan 2012 20:16:03 +0100 Subject: [PATCH] Setting MARC-8 on reader, not writer. Set to skip bad indicator --- src/org/marc4j/samples/Marc8ToMarcXmlExample.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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(); -- 1.7.10.4