Setting MARC-8 on reader, not writer. Set to skip bad indicator
authorDennis Schafroth <dennis@indexdata.com>
Wed, 4 Jan 2012 19:16:03 +0000 (20:16 +0100)
committerDennis Schafroth <dennis@indexdata.com>
Wed, 4 Jan 2012 19:16:03 +0000 (20:16 +0100)
src/org/marc4j/samples/Marc8ToMarcXmlExample.java

index 9bf6b06..f462819 100644 (file)
@@ -25,11 +25,9 @@ import java.io.FileInputStream;
 import java.io.InputStream;\r
 import java.io.OutputStream;\r
 \r
-import org.marc4j.MarcReader;\r
 import org.marc4j.MarcStreamReader;\r
 import org.marc4j.MarcWriter;\r
 import org.marc4j.MarcXmlWriter;\r
-import org.marc4j.converter.impl.AnselToUnicode;\r
 import org.marc4j.marc.Record;\r
 \r
 /**\r
@@ -42,19 +40,22 @@ public class Marc8ToMarcXmlExample {
 \r
     public static void main(String args[]) throws Exception {\r
       InputStream input; \r
-        if (args.length > 0) \r
+        if (args.length > 0)  {\r
           input = new FileInputStream(new File(args[0]));\r
+        }\r
         else \r
           input = ReadMarcExample.class\r
                .getResourceAsStream("resources/brkrtest.mrc");\r
 \r
         OutputStream out = System.out;\r
 \r
-        MarcReader reader = new MarcStreamReader(input);\r
+        MarcStreamReader reader = new MarcStreamReader(input, "MARC-8");\r
+        // Do not set bad indicators \r
+        reader.setBadIndicators(false);\r
         MarcWriter writer = new MarcXmlWriter(out, true);\r
 \r
-        AnselToUnicode converter = new AnselToUnicode();\r
-        writer.setConverter(converter);\r
+        //AnselToUnicode converter = new AnselToUnicode();\r
+        //writer.setConverter(converter);\r
 \r
         while (reader.hasNext()) {\r
             Record record = reader.next();\r