Documentation
¶
Overview ¶
Package xmp provides XMP (Extensible Metadata Platform) encoding and decoding. XMP stores structured metadata as RDF/XML, organized into namespaced properties that can be simple strings, ordered or unordered arrays, localized alternatives, or nested structures.
Index ¶
- type Item
- func NewAlt(ns, prefix, name string, langValues ...[2]string) *Item
- func NewBag(ns, prefix, name string, values ...string) *Item
- func NewItem(ns, prefix, name, value string) *Item
- func NewItemLang(ns, prefix, name, lang, value string) *Item
- func NewSeq(ns, prefix, name string, values ...string) *Item
- func NewStruct(ns, prefix, name string, fields ...*Item) *Item
- func (it *Item) Any() any
- func (it *Item) Bytes() []byte
- func (it *Item) Image() image.Image
- func (it *Item) ItemKind() Kind
- func (it *Item) Items() []*Item
- func (it *Item) Key() string
- func (it *Item) Lang() string
- func (it *Item) LocalName() string
- func (it *Item) MarshalJSON() ([]byte, error)
- func (it *Item) NS() string
- func (it *Item) Prefix() string
- func (it *Item) String() string
- func (it *Item) Value() string
- type Kind
- type XMP
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item struct {
// contains filtered or unexported fields
}
Item represents a single XMP metadata property and implements media.Metadata.
func NewAlt ¶
NewAlt creates an alternatives property. langValues is a sequence of [lang, value] pairs; use "x-default" as the lang for the canonical value.
func NewItemLang ¶
NewItemLang creates a Simple property with an xml:lang qualifier.
func (*Item) Any ¶
Any returns the property value as an appropriate Go type (implements media.Metadata):
- Simple → string
- Bag/Seq → []string
- Alt → map[string]string (lang → value)
- Struct → []*Item
func (*Item) Lang ¶
Lang returns the xml:lang qualifier (non-empty for Simple items with a language tag and for Alt child items).
func (*Item) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
type XMP ¶
type XMP struct {
// contains filtered or unexported fields
}
XMP holds a parsed XMP metadata document.
func (*XMP) First ¶
First returns the first item with a non-empty value from the first matching key in the ordered list. This implements the priority-fallback pattern used when the same semantic field can appear under multiple namespace prefixes, e.g. x.First("photoshop:DateCreated", "exif:DateTimeOriginal", "xmp:CreateDate").
func (*XMP) Get ¶
Get returns all items whose key equals key. The key may be "prefix:name" or just the local name.
func (*XMP) MarshalJSON ¶
MarshalJSON implements json.Marshaler.