Documentation ¶
Overview ¶
Package marc21 reads MARC21 and MARCXML data.
Enables converting between MARC21 and MARCXML data.
Index ¶
- Constants
- func NextRecord(r io.Reader) (rawRec []byte, err error)
- type Collection
- type Controlfield
- type Datafield
- type Leader
- type Record
- func (rec Record) AsXML() (ret string, err error)
- func (rec Record) BibliographyMaterialType() (code, label string)
- func (rec Record) CharacterCodingScheme() (code, label string)
- func (rec Record) GetControlfield(tag string) string
- func (rec Record) GetControlfields(tags string) (cfs []*Controlfield)
- func (rec Record) GetDatafields(tags string) (dfs []*Datafield)
- func (rec Record) RecordAsMARC() (marc []byte, err error)
- func (rec Record) RecordFormat() int
- func (rec Record) RecordFormatName() string
- func (rec Record) RecordType() (code, label string)
- func (rec Record) String() string
- type Subfield
Constants ¶
const ( // FmtUnknown indicates that the record format is not known or not specified FmtUnknown = iota // Bibliography indicates that the record is a Bibliography (or bib-holding) record Bibliography // Holdings indicates that the record is a Holdings record Holdings // Authority indicates that the record is an Authority record Authority // Classification indicates that the record is a Classification record Classification // Community indicates that the record is a Community Information record Community )
CollectionXMLFooter being the footer (closing collection tag) of a MARCXML document
const CollectionXMLHeader = `` /* 274-byte string literal not displayed */
CollectionXMLHeader being the header (XML declaration and opening collection tag) of a MARCXML document
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Collection ¶
Collection is for containing zero or more MARC records
func (Collection) AsXML ¶
func (c Collection) AsXML() (ret string, err error)
AsXML converts an entire collection to XML
type Controlfield ¶
Controlfield contains a controlfield entry
func (Controlfield) GetTag ¶
func (cf Controlfield) GetTag() string
GetTag returns the tag for the controlfield
func (Controlfield) GetText ¶
func (cf Controlfield) GetText() string
GetText returns the text for the controlfield
func (Controlfield) String ¶
func (cf Controlfield) String() string
Implement the Stringer interface for "Pretty-printing"
type Datafield ¶
type Datafield struct { Tag string `xml:"tag,attr"` Ind1 string `xml:"ind1,attr"` Ind2 string `xml:"ind2,attr"` Subfields []*Subfield `xml:"subfield"` }
Datafield contains a datafield entry
func (Datafield) GetSubfields ¶
GetSubfields returns subfields for the datafield that match the specified codes. If no codes are specified (empty string) then all subfields are returned
type Leader ¶
type Leader struct {
Text string `xml:",chardata"`
}
Leader is for containing the text string of the MARC record Leader
type Record ¶
type Record struct { Leader Leader `xml:"leader"` Controlfields []*Controlfield `xml:"controlfield"` Datafields []*Datafield `xml:"datafield"` }
Record is for containing a MARC record
func ParseNextRecord ¶
ParseNextRecord reads the next MARC record and returns the parsed record structure
func ParseRecord ¶
ParseRecord takes the bytes for a MARC record and returns the parsed record structure
func (Record) BibliographyMaterialType ¶
BibliographyMaterialType returns the code and description of the type of material documented by Bibliography the record. {"Books", "Computer Files", "Maps", "Music", "Continuing Resources", "Visual Materials" or "Mixed Materials"}
func (Record) CharacterCodingScheme ¶
CharacterCodingScheme returns the code and label indicating the "09 - Character coding scheme" of the record (MARC-8 or UCS/Unicode).
func (Record) GetControlfield ¶
GetControlfield returns the text value of the first control field for the record that matches the specified (presumably non-repeating) tag
func (Record) GetControlfields ¶
func (rec Record) GetControlfields(tags string) (cfs []*Controlfield)
GetControlfields returns the unique set of controlfields for the record that match the specified tags. If no tags are specified (empty string) then all controlfields are returned
func (Record) GetDatafields ¶
GetDatafields returns datafields for the record that match the specified comma separated list of tags. If no tags are specified (empty string) then all datafields are returned
func (Record) RecordAsMARC ¶
RecordAsMARC converts a Record into a MARC record byte array
func (Record) RecordFormat ¶
RecordFormat indicates the high level nature of the record and is used to differentiate between Bibliography, Holdings, Authority, Classification, and Community record formats.
func (Record) RecordFormatName ¶
RecordFormatName indicates the name of the format of the record and is used to differentiate between Bibliography, Holdings, Authority, Classification, and Community record formats.
func (Record) RecordType ¶
RecordType returns the one character code and label indicating the "06 - Type of record" for the record. Use RecordFormat to determine the record format (bibliographic, holdings, etc.)