MARC XML Parser

This module is used to parse MARC XML and OAI documents. Module provides API to query such records and also to create records from scratch.

Module also contains getters which allows highlevel queries over documents, such as get_name() and get_authors(), which returns informations scattered over multiple subfields.

Package is developed and maintained by E-deposit team.

Package structure

Parser is split into multiple classes, which each have own responsibility. Most important is class MARCXMLRecord, which contains MARCXMLParser, MARCXMLSerializer and MARCXMLQuery.

File relations

Import relations of files in project:

_images/relations.png

Class relations

Relations of the classes in project:

_images/class_relations.png

Installation

Module is hosted at PYPI, and can be easily installed using PIP:

sudo pip install marcxml_parser

Source code

Project is released as opensource (MIT) and source code can be found at GitHub:

Unittests

Almost every feature of the project is tested by unittests. You can run those tests using provided run_tests.sh script, which can be found in the root of the project.

Requirements

This script expects that pytest is installed. In case you don’t have it yet, it can be easily installed using following command:

pip install --user pytest

or for all users:

sudo pip install pytest

Example

$ ./run_tests.sh
============================= test session starts ==============================
platform linux2 -- Python 2.7.6 -- py-1.4.26 -- pytest-2.6.4
collected 66 items

tests/test_module.py ..
tests/test_parser.py ............
tests/test_query.py ...............................
tests/test_record.py .
tests/test_serializer.py .......
tests/structures/test__structures_module.py .
tests/structures/test_corporation.py .
tests/structures/test_marcsubrecord.py .
tests/structures/test_person.py .
tests/structures/test_publication_type.py .
tests/tools/test_resorted.py ........

========================== 66 passed in 1.14 seconds ===========================

Indices and tables