xml_convertor submodule

This module contains convertors for converting MODS to XML required by URN:NBN project.

See:
cz_urnnbn_api.xml_convertor.pick_only_text(fn)
class cz_urnnbn_api.xml_convertor.MonographPublication(mods_xml)

Bases: object

This class accepts MODS monographic data, which can then convert to XML for URN:NBN.

get_title(*args, **kwargs)
get_subtitle(*args, **kwargs)
get_author()
Returns:Author’s name.
Return type:str
get_form()
Returns:Form of the book. Electronic source, and so on..
Return type:str
get_place()
Returns:Place where the book was released.
Return type:str
get_publisher(*args, **kwargs)
get_year(*args, **kwargs)
get_identifier(*args, **kwargs)
get_ccnb(*args, **kwargs)
get_isbn(*args, **kwargs)
get_uuid(*args, **kwargs)
compose()

Convert self to nested ordered dicts, which may be serialized to XML using xmltodict module.

Returns:XML parsed to ordered dicts.
Return type:OrderedDict
add_format(file_format)

Add informations about file_format to internal XML dict.

Parameters:file_format (str) – PDF, jpeg, etc..
to_xml()

Convert itself to XML unicode string.

Returns:XML.
Return type:unicode
class cz_urnnbn_api.xml_convertor.MonographVolume(mods_xml)

Bases: cz_urnnbn_api.xml_convertor.MonographPublication

Conversion of Multi-monograph data to XML required by URN:NBN.

get_volume_title(*args, **kwargs)
compose()

Convert self to nested ordered dicts, which may be serialized to XML using xmltodict module.

Returns:XML parsed to ordered dicts.
Return type:OrderedDict
cz_urnnbn_api.xml_convertor.convert_mono_xml(mods_xml, file_format)

Convert MODS monograph record to XML, which is required by URN:NBN resolver.

Parameters:mods_xml (str) – MODS volume XML.
Returns:XML for URN:NBN resolver.
Return type:str
Raises:ValueError – If can’t find required data in MODS (author, title).
cz_urnnbn_api.xml_convertor.convert_mono_volume_xml(mods_volume_xml, file_format)

Convert MODS monograph, multi-volume record to XML, which is required by URN:NBN resolver.

Parameters:mods_volume_xml (str) – MODS volume XML.
Returns:XML for URN:NBN resolver.
Return type:str
Raises:ValueError – If can’t find required data in MODS (author, title).