Xmp Wyam.Xmp

Reads XMP data from the input documents and adds it to the document metadata.
The SourceFilePath metadata key of each input document will be used to locate any sidecar files.

Package

This module exists in the Wyam.Xmp package which is not part of the core distribution. Add the following preprocessor directive to your configuration file to use it:
#n Wyam.Xmp

Usage

  • Xmp(bool skipElementOnMissingMandatoryData = false, bool errorsOnDoubleKeys = true, bool delocalizing = true, bool flatten = true)

    Reads XMP data from the input documents and adds it to the document metadata with the specified options.

    • skipElementOnMissingMandatoryData

      If mandatory data is missing, the element will be skipped.

    • errorsOnDoubleKeys

      If true (the default), an error will be produced if the XML metadata would overwrite existing document metadata. If false, the XMP metadata overrides the existing metadata.

    • delocalizing

      If true (the default), when multiple elements with different languages are present, the local language will be used to choose the correct element.

    • flatten

      If true (the default), when an array has only one element the output metadata is reduced to the single element.

Fluent Methods

Chain these methods together after the constructor to modify behavior.

  • WithMetadata(string xmpPath, string targetMetadata, bool isMandatory = false)

    Specifies an XML element to find in the XMP data along with the metadata key that will be used to set it in the document.

    • xmpPath

      The tag name of the XMP element including the namespace prefix.

    • targetMetadata

      The metadata key where the value should be added to the document.

    • isMandatory

      Specifies that the input should contain the XMP metadata.

  • WithNamespace(string xmlNamespace, string alias)

    Adds or overrides a namespace for resolving namespace prefixes of the xmpPath specified in Wyam.Xmp.Xmp.WithMetadata(System.String,System.String,System.Boolean). Several default namespaces are predefined:

    • dc - - http://purl.org/dc/elements/1.1/
    • xmpRights - - http://ns.adobe.com/xap/1.0/rights/
    • cc - - http://creativecommons.org/ns#
    • xmp - - http://ns.adobe.com/xap/1.0/
    • xml - - http://www.w3.org/XML/1998/namespace

    • xmlNamespace

      The namespace to define.

    • alias

      The namespace alias.

GitHub