Simple Dublin Core

Generation of Simple Dublin Core XML v1.1.

By default the package will wrap elements in an OAI DC element. This behavior can be changed by specifying container, nsmap and attribs to the API functions.

dcxml.simpledc.dump_etree(data, container=None, nsmap=None, attribs=None)[source]

Convert dictionary to Simple Dublin Core XML as ElementTree.

Parameters:
  • data – Dictionary.
  • container – Name (include namespace) of container element.
  • nsmap – Namespace mapping for lxml.
  • attribs – Default attributes for container element.
Returns:

LXML ElementTree.

dcxml.simpledc.tostring(data, **kwargs)[source]

Convert dictionary to Simple Dublin Core XML as string.

Parameters:
  • data – Dictionary.
  • container – Name (include namespace) of container element.
  • nsmap – Namespace mapping for lxml.
  • attribs – Default attributes for container element.
Returns:

LXML ElementTree.

dcxml.simpledc.ns = {'xml': 'xml', 'oai_dc': 'http://www.openarchives.org/OAI/2.0/oai_dc/', 'xsi': 'http://www.w3.org/2001/XMLSchema-instance', 'dc': 'http://purl.org/dc/elements/1.1/'}

Default namespace mapping.

dcxml.simpledc.container_attribs = {'{http://www.w3.org/2001/XMLSchema-instance}schemaLocation': 'http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd'}

Default container element attributes.

dcxml.simpledc.container_element = '{http://www.openarchives.org/OAI/2.0/oai_dc/}dc'

Default container element.