opc

package
v0.0.0-...-c24bf96 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2015 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeCoreProperties              = "application/vnd.openxmlformats-package.core-properties+xml"
	ContentTypeDigitalSignatureCertificate = "application/vnd.openxmlformats-package.digital-signaturecertificate"
	ContentTypeDigitalSignatureOrigin      = "application/vnd.openxmlformats-package.digital-signature-origin"
	ContentTypeXMLSignature                = "application/vnd.openxmlformats-package.digital-signaturexmlsignature+xml"
	ContentTypeRelationships               = "application/vnd.openxmlformats-package.relationships+xml"
)

From ECMA-376 Annex F. Standard Namespaces and Content Types

Variables

View Source
var DefaultReadFormatter = &ReadFormatter{}

Functions

func RegisterReadFormat

func RegisterReadFormat(contentType string, fn func(pkg *Package, partName string, in io.Reader) error)

Types

type ContentTypeDefault

type ContentTypeDefault struct {
	Extension   string `xml:",attr"`
	ContentType string `xml:",attr"`
}

type ContentTypeOverride

type ContentTypeOverride struct {
	PartName    string `xml:",attr"`
	ContentType string `xml:",attr"`
}

type ContentTypes

type ContentTypes struct {
	XMLName  xml.Name `xml:"http://schemas.openxmlformats.org/package/2006/content-types Types"`
	Default  []ContentTypeDefault
	Override []ContentTypeOverride
}

type Package

type Package struct {
	Part
	Types ContentTypes
	Parts []*Part
}

func Open

func Open(name string) (*Package, error)

func Read

func Read(in io.Reader) (*Package, error)

func (*Package) ContentType

func (p *Package) ContentType(partName string) string

func (*Package) FindPart

func (p *Package) FindPart(partName string) *Part

func (*Package) FindPartsByRelationOn

func (p *Package) FindPartsByRelationOn(base *Part, filter func(*Relationship) bool) []*Part

type Part

type Part struct {
	Name          string
	ContentType   string
	GrowthHint    string
	Relationships []*Relationship
	Content       interface{}
}

type ReadFormatter

type ReadFormatter struct {
	// contains filtered or unexported fields
}

func (*ReadFormatter) RegisterFormat

func (rd *ReadFormatter) RegisterFormat(contentType string, read func(*Package, string, io.Reader) error)

type RelationType

type RelationType string
const (
	RelationTypeCoreProperties              RelationType = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"
	RelatinoTypeDigitalSignature            RelationType = "http://schemas.openxmlformats.org/package/2006/relationships/digitalsignature/signature"
	RelatinoTypeDigitalSignatureCertificate RelationType = "http://schemas.openxmlformats.org/package/2006/relationships/digitalsignature/certificate"
	RelatinoTypeDigitalSignatureOrigin      RelationType = "http://schemas.openxmlformats.org/package/2006/relationships/digitalsignature/origin"
	RelationTypeThumbnail                   RelationType = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail"
)

From ECMA-376 Annex F. Standard Namespaces and Content Types

type Relationship

type Relationship struct {
	ID     string       `xml:"Id,attr"`
	Type   RelationType `xml:",attr"`
	Target string       `xml:",attr"`
}

type ZipReader

type ZipReader struct {
	*ReadFormatter
}

func (*ZipReader) Open

func (rd *ZipReader) Open(name string) (*Package, error)

func (*ZipReader) Read

func (rd *ZipReader) Read(in io.Reader) (*Package, error)

Jump to

Keyboard shortcuts

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