mappings

package
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package mappings contains struct mappings to unmarshal three different PRONOM XML formats: the DROID signature file format, the report format, and the container format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteSeq

type ByteSeq struct {
	Reference    string        `xml:"Reference,attr"`
	SubSequences []SubSequence `xml:"SubSequence"`
}

type ByteSequence

type ByteSequence struct {
	Position    string `xml:"PositionType"`
	Offset      string
	MaxOffset   string
	IndirectLoc string `xml:"IndirectOffsetLocation"`
	IndirectLen string `xml:"IndirectOffsetLength"`
	Endianness  string
	Hex         string `xml:"ByteSequenceValue"`
}

func (ByteSequence) String

func (bs ByteSequence) String() string

type Container

type Container struct {
	XMLName             xml.Name             `xml:"ContainerSignatureMapping"`
	ContainerSignatures []ContainerSignature `xml:"ContainerSignatures>ContainerSignature"`
	FormatMappings      []FormatMapping      `xml:"FileFormatMappings>FileFormatMapping"`
	TriggerPuids        []TriggerPuid        `xml:"TriggerPuids>TriggerPuid"`
}

func (*Container) Puids

func (c *Container) Puids() []string

type ContainerSignature

type ContainerSignature struct {
	Id            int    `xml:",attr"`
	ContainerType string `xml:",attr"`
	Description   string
	Files         []File `xml:"Files>File"`
}

type Droid

type Droid struct {
	XMLName     xml.Name            `xml:"FFSignatureFile"`
	Version     int                 `xml:",attr"`
	Signatures  []InternalSignature `xml:"InternalSignatureCollection>InternalSignature"`
	FileFormats []FileFormat        `xml:"FileFormatCollection>FileFormat"`
}

type File

type File struct {
	Path      string
	Signature InternalSignature `xml:"BinarySignatures>InternalSignatureCollection>InternalSignature"` // see Droid mapping file
}

type FileFormat

type FileFormat struct {
	XMLName    xml.Name `xml:"FileFormat"`
	ID         int      `xml:"ID,attr"`
	Puid       string   `xml:"PUID,attr"`
	Name       string   `xml:",attr"`
	Version    string   `xml:",attr"`
	MIMEType   string   `xml:",attr"`
	Extensions []string `xml:"Extension"`
	Signatures []int    `xml:"InternalSignatureID"`
	Priorities []int    `xml:"HasPriorityOverFileFormatID"`
}

type FormatIdentifier

type FormatIdentifier struct {
	Typ string `xml:"IdentifierType"`
	Id  string `xml:"Identifier"`
}

type FormatMapping

type FormatMapping struct {
	Id   int    `xml:"signatureId,attr"`
	Puid string `xml:",attr"`
}

type Fragment

type Fragment struct {
	Value     string `xml:",chardata"`
	MinOffset string `xml:",attr"`
	MaxOffset string `xml:",attr"`
	Position  int    `xml:",attr"`
}

type InternalSignature

type InternalSignature struct {
	ID            int       `xml:"ID,attr"`
	ByteSequences []ByteSeq `xml:"ByteSequence"`
}

type KeyVal

type KeyVal struct {
	Key string
	Val []string
}

type OrderedMap

type OrderedMap []KeyVal

OrderedMap define an ordered map

func (OrderedMap) MarshalJSON

func (omap OrderedMap) MarshalJSON() ([]byte, error)

Implement the json.Marshaler interface

type Outline

type Outline struct {
	Typ   string `xml:"name,attr"`
	Puids []Puid `xml:"format>puid"`
}

type Puid

type Puid struct {
	Typ string `xml:"type,attr"`
	Val string `xml:",chardata"`
}

type RelatedFormat

type RelatedFormat struct {
	Typ string `xml:"RelationshipType"`
	Id  int    `xml:"RelatedFormatID"`
}

type Release

type Release struct {
	ReleaseDate   string    `xml:"release_date"`
	SignatureName string    `xml:"signature_filename"`
	Outlines      []Outline `xml:"release_outline"`
}

type Releases

type Releases struct {
	XMLName  xml.Name  `xml:"release_notes"`
	Releases []Release `xml:"release_note"`
}

type Report

type Report struct {
	XMLName     xml.Name           `xml:"PRONOM-Report"`
	Id          int                `xml:"report_format_detail>FileFormat>FormatID"`
	Name        string             `xml:"report_format_detail>FileFormat>FormatName"`
	Version     string             `xml:"report_format_detail>FileFormat>FormatVersion"`
	Description string             `xml:"report_format_detail>FileFormat>FormatDescription"`
	Families    string             `xml:"report_format_detail>FileFormat>FormatFamilies"`
	Types       string             `xml:"report_format_detail>FileFormat>FormatTypes"`
	Identifiers []FormatIdentifier `xml:"report_format_detail>FileFormat>FileFormatIdentifier"`
	Signatures  []Signature        `xml:"report_format_detail>FileFormat>InternalSignature"`
	Extensions  []string           `xml:"report_format_detail>FileFormat>ExternalSignature>Signature"`
	Relations   []RelatedFormat    `xml:"report_format_detail>FileFormat>RelatedFormat"`
}

func (*Report) Label

func (r *Report) Label(puid string) string

func (*Report) MIME

func (r *Report) MIME() string

func (*Report) Subordinates

func (r *Report) Subordinates() []int

func (*Report) Superiors

func (r *Report) Superiors() []int

type Signature

type Signature struct {
	ByteSequences []ByteSequence `xml:"ByteSequence"`
}

func (Signature) String

func (s Signature) String() string

type SubSequence

type SubSequence struct {
	Position        int    `xml:",attr"`
	SubSeqMinOffset string `xml:",attr"` // and empty int values are unmarshalled to 0
	SubSeqMaxOffset string `xml:",attr"` // uses string rather than int because value might be empty
	Sequence        string
	LeftFragments   []Fragment `xml:"LeftFragment"`
	RightFragments  []Fragment `xml:"RightFragment"`
}

type TriggerPuid

type TriggerPuid struct {
	ContainerType string `xml:",attr"`
	Puid          string `xml:",attr"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL