org.marc4j.marcxml
Class MarcXmlReader

java.lang.Object
  |
  +--org.marc4j.marcxml.MarcXmlReader
All Implemented Interfaces:
MarcHandler, XMLReader

public class MarcXmlReader
extends Object
implements XMLReader, MarcHandler

MarcXmlReader is an XMLReader that consumes MarcHandler events and reports events to a SAX2 ContentHandler.

Version:
$Revision$
Author:
Bas Peters
See Also:
MarcHandler, ContentHandler

Field Summary
 LexicalHandler lh
          the lexical handler object
 
Constructor Summary
MarcXmlReader()
           
 
Method Summary
 void controlField(String tag, char[] data)
          Reports a control field node (001-009).
 void endCollection()
          Reports the closing element for the root, reports the end of the prefix mapping and the end a document.
 void endDataField(String tag)
          Reports the closing element for a data field.
 void endRecord()
          Reports the closing element for a record.
 ContentHandler getContentHandler()
          Returns the content handler.
 DTDHandler getDTDHandler()
           
 EntityResolver getEntityResolver()
           
 ErrorHandler getErrorHandler()
           
 boolean getFeature(String name)
          Returns the boolean for the feature with the given name.
 Object getProperty(String name)
          Returns the object for the given property.
 void parse(InputSource input)
          Sends the input source to the MarcReader.
 void parse(String systemId)
          Parse input from a system identifier (URI).
 void setContentHandler(ContentHandler ch)
          Sets the content handler.
 void setDTDHandler(DTDHandler dh)
          Not supported.
 void setEntityResolver(EntityResolver er)
          Not supported.
 void setErrorHandler(ErrorHandler seh)
          Not supported.
 void setFeature(String name, boolean value)
          Sets the boolean for the feature with the given name.
 void setProperty(String name, Object obj)
          Sets the object for the given property.
 void startCollection()
          Returns the document handler being used, starts the document and reports the root element.
 void startDataField(String tag, char ind1, char ind2)
          Reports the starting element for a data field (010-999).
 void startRecord(Leader leader)
          Reports the starting element for a record and the leader node.
 void subfield(char code, char[] data)
          Reports a subfield node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lh

public LexicalHandler lh
the lexical handler object

Constructor Detail

MarcXmlReader

public MarcXmlReader()
Method Detail

setContentHandler

public void setContentHandler(ContentHandler ch)

Sets the content handler.

Specified by:
setContentHandler in interface XMLReader
Parameters:
ch -

getContentHandler

public ContentHandler getContentHandler()

Returns the content handler.

Specified by:
getContentHandler in interface XMLReader
Returns:
ch

setEntityResolver

public void setEntityResolver(EntityResolver er)

Not supported.

Specified by:
setEntityResolver in interface XMLReader
Parameters:
er -

getEntityResolver

public EntityResolver getEntityResolver()
Specified by:
getEntityResolver in interface XMLReader

setDTDHandler

public void setDTDHandler(DTDHandler dh)

Not supported.

Specified by:
setDTDHandler in interface XMLReader
Parameters:
dh -

getDTDHandler

public DTDHandler getDTDHandler()
Specified by:
getDTDHandler in interface XMLReader

setErrorHandler

public void setErrorHandler(ErrorHandler seh)

Not supported.

Specified by:
setErrorHandler in interface XMLReader

getErrorHandler

public ErrorHandler getErrorHandler()
Specified by:
getErrorHandler in interface XMLReader

setProperty

public void setProperty(String name,
                        Object obj)
                 throws SAXNotRecognizedException,
                        SAXNotSupportedException

Sets the object for the given property.

Specified by:
setProperty in interface XMLReader
Parameters:
name - the property name
obj - the property object
SAXNotRecognizedException
SAXNotSupportedException

getProperty

public Object getProperty(String name)
                   throws SAXNotRecognizedException,
                          SAXNotSupportedException

Returns the object for the given property.

Specified by:
getProperty in interface XMLReader
Parameters:
name - the property name
SAXNotRecognizedException
SAXNotSupportedException

setFeature

public void setFeature(String name,
                       boolean value)
                throws SAXNotRecognizedException,
                       SAXNotSupportedException

Sets the boolean for the feature with the given name.

Specified by:
setFeature in interface XMLReader
Parameters:
name - the name of the feature
value - the boolean value
SAXNotRecognizedException
SAXNotSupportedException

getFeature

public boolean getFeature(String name)
                   throws SAXNotRecognizedException

Returns the boolean for the feature with the given name.

Specified by:
getFeature in interface XMLReader
Parameters:
name - the name of the feature
SAXNotRecognizedException

parse

public void parse(String systemId)
           throws SAXException,
                  IOException

Parse input from a system identifier (URI).

Specified by:
parse in interface XMLReader
Parameters:
systemId - the system identifier (URI)
SAXException
IOException

parse

public void parse(InputSource input)

Sends the input source to the MarcReader.

Specified by:
parse in interface XMLReader
Parameters:
input - the InputSource

startCollection

public void startCollection()

Returns the document handler being used, starts the document and reports the root element.

Specified by:
startCollection in interface MarcHandler

startRecord

public void startRecord(Leader leader)

Reports the starting element for a record and the leader node.

Specified by:
startRecord in interface MarcHandler
Parameters:
leader - the leader

controlField

public void controlField(String tag,
                         char[] data)

Reports a control field node (001-009).

Specified by:
controlField in interface MarcHandler
Parameters:
tag - the tag name
data - the data element

startDataField

public void startDataField(String tag,
                           char ind1,
                           char ind2)

Reports the starting element for a data field (010-999).

Specified by:
startDataField in interface MarcHandler
Parameters:
tag - the tag name
ind1 - the first indicator value
ind2 - the second indicator value

subfield

public void subfield(char code,
                     char[] data)

Reports a subfield node.

Specified by:
subfield in interface MarcHandler
Parameters:
code - the data element identifier
data - the data element

endDataField

public void endDataField(String tag)

Reports the closing element for a data field.

Specified by:
endDataField in interface MarcHandler
Parameters:
tag - the tag name

endRecord

public void endRecord()

Reports the closing element for a record.

Specified by:
endRecord in interface MarcHandler

endCollection

public void endCollection()

Reports the closing element for the root, reports the end of the prefix mapping and the end a document.

Specified by:
endCollection in interface MarcHandler


Copyright 2001-2003 Bas Peters. All Rights Reserved.