public class MarcContentHandler extends java.lang.Object implements MarcXchangeConstants, MarcListener, MarcRecordListener, org.xml.sax.EntityResolver, org.xml.sax.DTDHandler, org.xml.sax.ContentHandler, org.xml.sax.ErrorHandler
Modifier and Type | Field and Description |
---|---|
protected java.lang.StringBuilder |
content |
protected java.lang.String |
format |
protected java.util.Map<java.lang.String,MarcListener> |
listeners |
protected MarcListener |
marcListener |
protected MarcValueTransformers |
marcValueTransformers |
protected java.util.concurrent.atomic.AtomicInteger |
recordCounter |
protected java.util.Deque<MarcField.Builder> |
stack |
protected java.lang.String |
type |
BIBLIOGRAPHIC_TYPE, CODE_ATTRIBUTE, COLLECTION, CONTROLFIELD, DATAFIELD, FORMAT_ATTRIBUTE, HOLDINGS_TYPE, IND_ATTRIBUTE, LEADER, MARC21_FORMAT, MARC21_SCHEMA_LOCATION, MARC21_SCHEMA_URI, MARCXCHANGE_FORMAT, MARCXCHANGE_V1_NS_URI, MARCXCHANGE_V2_0_SCHEMA_LOCATION, MARCXCHANGE_V2_NS_URI, RECORD, SUBFIELD, TAG_ATTRIBUTE, TYPE_ATTRIBUTE
Constructor and Description |
---|
MarcContentHandler() |
Modifier and Type | Method and Description |
---|---|
MarcContentHandler |
addNamespace(java.lang.String uri) |
void |
beginCollection()
Begin of a record collection.
|
void |
beginRecord(java.lang.String format,
java.lang.String type)
Begin of a record.
|
void |
characters(char[] ch,
int start,
int length) |
void |
endCollection()
End of a collection.
|
void |
endDocument() |
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName) |
void |
endPrefixMapping(java.lang.String prefix) |
void |
endRecord()
End of a record.
|
void |
error(org.xml.sax.SAXParseException exception) |
void |
fatalError(org.xml.sax.SAXParseException exception) |
void |
field(MarcField marcField)
A field.
|
protected java.lang.String |
getDefaultFormat() |
protected java.lang.String |
getDefaultType() |
java.lang.String |
getFormat() |
int |
getRecordCounter() |
java.lang.String |
getType() |
void |
ignorableWhitespace(char[] ch,
int start,
int length) |
protected boolean |
isNamespace(java.lang.String uri) |
void |
leader(java.lang.String label)
The leader (or label) of a record.
|
void |
notationDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId) |
void |
processingInstruction(java.lang.String target,
java.lang.String data) |
void |
record(MarcRecord marcRecord)
Receive a MARC Record.
|
org.xml.sax.InputSource |
resolveEntity(java.lang.String publicId,
java.lang.String systemId) |
void |
setDocumentLocator(org.xml.sax.Locator locator) |
MarcContentHandler |
setFormat(java.lang.String format) |
MarcContentHandler |
setMarcFieldTransformers(MarcFieldTransformers marcFieldTransformers)
Set MARC field transformers.
|
MarcContentHandler |
setMarcListener(MarcListener listener)
Set MARC listener for the default record type.
|
MarcContentHandler |
setMarcListener(java.lang.String type,
MarcListener listener)
Set MARC listener for a specific record type.
|
MarcContentHandler |
setMarcValueTransformers(MarcValueTransformers marcValueTransformers)
Set MARC field value transformer for transforming field values.
|
MarcContentHandler |
setType(java.lang.String type) |
void |
skippedEntity(java.lang.String name) |
void |
startDocument() |
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts) |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri) |
void |
unparsedEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String notationName) |
void |
warning(org.xml.sax.SAXParseException exception) |
protected final java.util.concurrent.atomic.AtomicInteger recordCounter
protected java.util.Deque<MarcField.Builder> stack
protected java.util.Map<java.lang.String,MarcListener> listeners
protected java.lang.StringBuilder content
protected MarcListener marcListener
protected java.lang.String format
protected java.lang.String type
protected MarcValueTransformers marcValueTransformers
protected java.lang.String getDefaultFormat()
protected java.lang.String getDefaultType()
public MarcContentHandler setMarcListener(java.lang.String type, MarcListener listener)
type
- the record typelistener
- the MARC listenerpublic MarcContentHandler setMarcListener(MarcListener listener)
listener
- the MARC listenerpublic MarcContentHandler addNamespace(java.lang.String uri)
public MarcContentHandler setMarcValueTransformers(MarcValueTransformers marcValueTransformers)
marcValueTransformers
- the value transformerpublic MarcContentHandler setMarcFieldTransformers(MarcFieldTransformers marcFieldTransformers)
marcFieldTransformers
- the MARC field transformerspublic void beginCollection()
MarcListener
beginCollection
in interface MarcListener
beginCollection
in interface MarcRecordListener
public void endCollection()
MarcListener
endCollection
in interface MarcListener
endCollection
in interface MarcRecordListener
public void beginRecord(java.lang.String format, java.lang.String type)
MarcListener
beginRecord
in interface MarcListener
format
- the record formattype
- the record typepublic void leader(java.lang.String label)
MarcListener
leader
in interface MarcListener
label
- the labelpublic void field(MarcField marcField)
MarcListener
field
in interface MarcListener
marcField
- the field.public void record(MarcRecord marcRecord)
MarcRecordListener
record
in interface MarcRecordListener
marcRecord
- the recordpublic void endRecord()
MarcListener
endRecord
in interface MarcListener
public void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator
in interface org.xml.sax.ContentHandler
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
startPrefixMapping
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
endPrefixMapping
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ignorableWhitespace
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
processingInstruction
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException
skippedEntity
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
public void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
notationDecl
in interface org.xml.sax.DTDHandler
org.xml.sax.SAXException
public void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName) throws org.xml.sax.SAXException
unparsedEntityDecl
in interface org.xml.sax.DTDHandler
org.xml.sax.SAXException
public org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException, java.io.IOException
resolveEntity
in interface org.xml.sax.EntityResolver
org.xml.sax.SAXException
java.io.IOException
public void warning(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
warning
in interface org.xml.sax.ErrorHandler
org.xml.sax.SAXException
public void error(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
error
in interface org.xml.sax.ErrorHandler
org.xml.sax.SAXException
public void fatalError(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
fatalError
in interface org.xml.sax.ErrorHandler
org.xml.sax.SAXException
public java.lang.String getFormat()
public MarcContentHandler setFormat(java.lang.String format)
public java.lang.String getType()
public MarcContentHandler setType(java.lang.String type)
public int getRecordCounter()
protected boolean isNamespace(java.lang.String uri)