A utility to convert MARC-8 data to non-precomposed UCS/Unicode.
The MARC-8 to Unicode mapping used is the version with the March 2005 revisions.
4344454647484950515253
.getResourceAsStream("resources/brkrtest.mrc"); MarcReader reader = new MarcStreamReader(input); MarcWriter writer = new MarcStreamWriter(System.out, "UTF8"); AnselToUnicode converter = new AnselToUnicode(); writer.setConverter(converter); while (reader.hasNext()) { Record record = reader.next(); writer.write(record);
4748495051525354555657
OutputStream out = new FileOutputStream("c:/temp/summerland.xml"); MarcReader reader = new MarcStreamReader(input); MarcWriter writer = new MarcXmlWriter(out, true); AnselToUnicode converter = new AnselToUnicode(); writer.setConverter(converter); while (reader.hasNext()) { Record record = reader.next(); writer.write(record);
5152535455565758596061
String stylesheetUrl = "http://www.loc.gov/standards/mods/v3/MARC21slim2MODS3.xsl"; Source stylesheet = new StreamSource(stylesheetUrl); DOMResult result = new DOMResult(); MarcXmlWriter writer = new MarcXmlWriter(result, stylesheet); writer.setConverter(new AnselToUnicode()); while (reader.hasNext()) { Record record = (Record) reader.next(); writer.write(record); } writer.close();