Original 2.4
[marc4j.git] / src / org / marc4j / samples / XercesSerializerExample.java
1 // $Id: XercesSerializerExample.java,v 1.1 2006/08/04 12:39:58 bpeters Exp $\r
2 /**\r
3  * Copyright (C) 2002-2006 Bas Peters\r
4  *\r
5  * This file is part of MARC4J\r
6  *\r
7  * MARC4J is free software; you can redistribute it and/or\r
8  * modify it under the terms of the GNU Lesser General Public \r
9  * License as published by the Free Software Foundation; either \r
10  * version 2.1 of the License, or (at your option) any later version.\r
11  *\r
12  * MARC4J is distributed in the hope that it will be useful,\r
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
15  * Lesser General Public License for more details.\r
16  *\r
17  * You should have received a copy of the GNU Lesser General Public \r
18  * License along with MARC4J; if not, write to the Free Software\r
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
20  */\r
21 package org.marc4j.samples;\r
22 \r
23 import java.io.InputStream;\r
24 \r
25 import javax.xml.transform.Result;\r
26 import javax.xml.transform.sax.SAXResult;\r
27 \r
28 // import org.apache.xml.serialize.OutputFormat;\r
29 // import org.apache.xml.serialize.XMLSerializer;\r
30 import org.marc4j.MarcReader;\r
31 import org.marc4j.MarcStreamReader;\r
32 import org.marc4j.MarcXmlWriter;\r
33 import org.marc4j.converter.impl.AnselToUnicode;\r
34 import org.marc4j.marc.Record;\r
35 \r
36 /**\r
37  * Serializes XML using Xerces serializer.\r
38  * \r
39  * <p>\r
40  * Commented out because Xerces is not a required library.\r
41  * \r
42  * @author Bas Peters\r
43  * @version $Revision: 1.1 $\r
44  */\r
45 public class XercesSerializerExample {\r
46 \r
47     public static void main(String args[]) throws Exception {\r
48 \r
49         InputStream input = ReadMarcExample.class\r
50                 .getResourceAsStream("resources/summerland.mrc");\r
51         MarcReader reader = new MarcStreamReader(input);\r
52 \r
53         // OutputFormat format = new OutputFormat("xml", "UTF-8", true);\r
54 \r
55         // XMLSerializer serializer = new XMLSerializer(System.out, format);\r
56         // Result result = new SAXResult(serializer.asContentHandler());\r
57 \r
58         // MarcXmlWriter writer = new MarcXmlWriter(result);\r
59         // writer.setConverter(new AnselToUnicode());\r
60         while (reader.hasNext()) {\r
61             Record record = reader.next();\r
62             // writer.write(record);\r
63         }\r
64         // writer.close();\r
65 \r
66     }\r
67 }\r