Example #1
0
 /**
  * Constructs an instance with the specified input source and stylesheet source.
  *
  * <p>The stylesheet is used to transform the source file and should produce valid MARCXML
  * records. The result is then used to create <code>Record</code> objects.
  *
  * @param input the input source
  * @param stylesheet the stylesheet source
  */
 public MarcXmlReader(final InputSource input, final Source stylesheet) {
   this.queue = new RecordStack();
   final MarcXmlParserThread producer = new MarcXmlParserThread(queue, input);
   final TransformerFactory factory = TransformerFactory.newInstance();
   final SAXTransformerFactory stf = (SAXTransformerFactory) factory;
   TransformerHandler th = null;
   try {
     th = stf.newTransformerHandler(stylesheet);
   } catch (final TransformerConfigurationException e) {
     throw new MarcException("Error creating TransformerHandler", e);
   }
   producer.setTransformerHandler(th);
   producer.start();
 }
Example #2
0
 /**
  * Constructs an instance with the specified input source.
  *
  * @param input the input source
  */
 public MarcXmlReader(final InputSource input) {
   this.queue = new RecordStack();
   final MarcXmlParserThread producer = new MarcXmlParserThread(queue, input);
   producer.start();
 }
Example #3
0
 /**
  * Constructs an instance with the specified input source and transformer handler.
  *
  * <p>The {@link javax.xml.transform.sax.TransformerHandler}&nbsp;is used to transform the source
  * file and should produce valid MARCXML records. The result is then used to create <code>Record
  * </code> objects. A <code>TransformerHandler</code> can be obtained from a <code>
  * SAXTransformerFactory</code> with either a {@link javax.xml.transform.Source}&nbsp;or {@link
  * javax.xml.transform.Templates}&nbsp;object.
  *
  * @param input the input source
  * @param th the transformation content handler
  */
 public MarcXmlReader(final InputSource input, final TransformerHandler th) {
   this.queue = new RecordStack();
   final MarcXmlParserThread producer = new MarcXmlParserThread(queue, input);
   producer.setTransformerHandler(th);
   producer.start();
 }