XM.Schema (XM v0.2.0)

Copy Markdown View Source

Declarative XML namespace and XSD schema metadata.

XM.Schema values are produced by the schema do ... end DSL inside an XM.document/2 block. They are not rendered as XML elements. Instead, they inject namespace declaration attributes into the document root and provide XSD locations for optional validation.

Summary

Functions

Return XML attributes that should be injected into the root element.

Return true when schema metadata declares at least one XSD location.

Return schema location paths/URLs declared by the schema metadata.

Build schema metadata from DSL entries.

Types

namespace()

@type namespace() :: %{
  prefix: String.t() | nil,
  uri: String.t(),
  location: String.t() | nil
}

t()

@type t() :: %XM.Schema{namespaces: [namespace()]}

Functions

attributes(schema)

@spec attributes(t()) :: [{String.t(), String.t()}]

Return XML attributes that should be injected into the root element.

has_locations?(schema)

@spec has_locations?(t()) :: boolean()

Return true when schema metadata declares at least one XSD location.

locations(schema)

@spec locations(t()) :: [String.t()]

Return schema location paths/URLs declared by the schema metadata.

new(entries)

@spec new(list()) :: t()

Build schema metadata from DSL entries.