https://github.com/miku/marc21
A MARC21 library for Go.
https://github.com/miku/marc21
code4lib marc
Last synced: 10 months ago
JSON representation
A MARC21 library for Go.
- Host: GitHub
- URL: https://github.com/miku/marc21
- Owner: miku
- License: other
- Created: 2014-07-14T15:05:32.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2019-08-18T11:15:36.000Z (over 6 years ago)
- Last Synced: 2025-03-25T06:33:57.101Z (11 months ago)
- Topics: code4lib, marc
- Language: Go
- Homepage:
- Size: 627 KB
- Stars: 7
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
marc21
======
A Go [MARC21](https://www.loc.gov/marc/bibliographic/) implementation.
This repository started as a fork of
[gitorious.org/marc21-go/marc21](https://gitorious.org/marc21-go/marc21), but
is - as of June 2017 - the new home of the MARC21 Go library.
As of August 2019, we are working on a revised implementation, as there are some edge cases the current implementation cannot handle.
Usage
-----
```go
file, _ := os.Open("somedata.mrc")
record, _ := marc21.ReadRecord(file)
_ = record.WriteTo(os.Stdout)
```
More examples
-------------
A [simple example](https://github.com/miku/marc21/blob/master/examples/simple.go).
```go
package main
import (
"io"
"log"
"os"
"github.com/miku/marc21"
)
func main() {
for {
r, err := marc21.ReadRecord(os.Stdin)
if err == io.EOF {
break
}
if err != nil {
log.Fatal(err)
}
if _, err := r.WriteTo(os.Stdout); err != nil {
log.Fatal(err)
}
}
}
```
```xml
$ cat fixtures/sandburg.mrc | go run examples/simple.go | xmllint --format -
01142cam 2200301 a 4500
92005291
DLC
19930521155141.9
920219s1993 caua j 000 0 eng
92005291
0152038655 :
$15.95
DLC
DLC
DLC
lcac
PS3537.A618
A88 1993
811/.52
20
Sandburg, Carl,
1878-1967.
Arithmetic /
Carl Sandburg ; illustrated as an anamorphic adventure by Ted Rand.
1st ed.
San Diego :
Harcourt Brace Jovanovich,
c1993.
1 v. (unpaged) :
ill. (some col.) ;
26 cm.
One Mylar sheet included in pocket.
A poem about numbers and their characteristics ...
Arithmetic
Juvenile poetry.
Children's poetry, American.
Arithmetic
Poetry.
American poetry.
Visual perception.
Rand, Ted,
ill.
```