FeedReader.Media.CandidateTracker (FeedReader v0.4.1)

Copy Markdown

Shared bookkeeping for media candidates captured by the built-in XML handlers.

Parser state must contain :feed_candidate_sequence and :item_candidate_sequence, each initialized with FeedReader.Media.CandidateSequence.new/0. path/3 turns the top-first frame stack and current element into a root-to-leaf path. A handler decides whether that path is eligible, then start/2 records the candidate's position in the feed or item sequence. complete/3 stores its value when the element closes; finalization therefore retains encounter order even when nested candidates close out of order. reset_item/1 starts a fresh sequence for the next item, and expanded_attributes/2 resolves attribute names in the element's namespace scope.

This module is an internal helper for the built-in format handlers, not a public extension API.

Summary

Types

position()

@type position() :: {scope(), FeedReader.Media.CandidateSequence.position()}

scope()

@type scope() :: :feed | :item

Functions

complete(state, arg, candidate)

@spec complete(map(), position(), term()) :: map()

expanded_attributes(attributes, namespace_scope)

@spec expanded_attributes(
  [{String.t(), String.t()}],
  FeedReader.XML.NamespaceScope.t()
) :: map()

path(frames, name, namespace_scope)

reset_item(state)

@spec reset_item(map()) :: map()

start(state, scope)

@spec start(map(), scope() | nil) :: {map(), position() | nil}