View Source Smee.Transform (Smee v0.5.0)
Tools for manipulating metadata XML.
This module is intended to make common and relatively simple actions on potentially large XML files more efficiently than
processing a metadata or entities using xmerl, and may rely on external tools such as xsltproc
.
These functions are useful for pre-processing metadata XML before it's broken up into entity struct, and to speed-up the internal workings of other modules.
Summary
Functions
Strips various extraneous parts from the metadata and returns a new struct in an :ok/:error tuple
Strips various extraneous parts from the metadata and returns a new struct in an :ok/:error tuple
Applies an XSLT stylesheet to a metadata struct, returning a transformed metadata struct in an :ok/error tuple
Returns a metadata struct with the validUntil date updated, in an :ok/:error struct
Returns a metadata struct with the validUntil date updated, or raises if an error occurs
Functions
@spec decruft_idp(metadata :: Smee.Metadata.t()) :: {:ok, Smee.Metadata.t()} | {:error, binary()}
Strips various extraneous parts from the metadata and returns a new struct in an :ok/:error tuple
@spec decruft_sp(metadata :: Smee.Metadata.t()) :: {:ok, Smee.Metadata.t()} | {:error, binary()}
Strips various extraneous parts from the metadata and returns a new struct in an :ok/:error tuple
@spec transform( metadata :: Smee.Metadata.t(), stylesheet :: binary(), params :: keyword() ) :: {:ok, Smee.Metadata.t()} | {:error, binary()}
Applies an XSLT stylesheet to a metadata struct, returning a transformed metadata struct in an :ok/error tuple
@spec valid_until(metadata :: Smee.Metadata.t(), date :: DateTime.t()) :: {:ok, Smee.Metadata.t()} | {:error, binary()}
Returns a metadata struct with the validUntil date updated, in an :ok/:error struct
@spec valid_until!(metadata :: Smee.Metadata.t(), date :: DateTime.t()) :: Smee.Metadata.t()
Returns a metadata struct with the validUntil date updated, or raises if an error occurs