xsd

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package xsd parses an XML Schema Definition. This package does a number of questionable things to handle the Trafikverket XSD, as their XSDs aren't strictly speaking valid.

The package only implements features necessary to deal with the Trafikverket XSDs and can't be used as a generic XSD decoder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type All

type All struct {
	XMLName    xml.Name    `xml:"all"`
	Annotation *Annotation `xml:"annotation"`
	Elements   []Element   `xml:"element"`
}

type Annotation

type Annotation struct {
	XMLName        xml.Name        `xml:"annotation"`
	Documentations []Documentation `xml:"documentation"`
}

type Attribute

type Attribute struct {
	XMLName xml.Name `xml:"attribute"`
	Name    string   `xml:"name,attr"`
	Type    string   `xml:"type,attr"`
	Use     string   `xml:"use,attr"`
}

type AttributeGroup

type AttributeGroup struct {
	XMLName    xml.Name    `xml:"attributeGroup"`
	Name       string      `xml:"name,attr"`
	Attributes []Attribute `xml:"attribute"`
	Ref        string      `xml:"ref,attr"`
}

type ComplexContent

type ComplexContent struct {
	XMLName    xml.Name    `xml:"complexContent"`
	Mixed      bool        `xml:"mixed,attr"`
	Annotation *Annotation `xml:"annotation"`
	Extension  Extension   `xml:"extension"`
}

type ComplexType

type ComplexType struct {
	XMLName         xml.Name         `xml:"complexType"`
	Name            string           `xml:"name,attr"`
	Mixed           bool             `xml:"mixed,attr"`
	All             *All             `xml:"all"`
	Sequence        *Sequence        `xml:"sequence"`
	SimpleContent   *SimpleContent   `xml:"simpleContent"`
	ComplexContent  *ComplexContent  `xml:"complexContent"`
	AttributeGroups []AttributeGroup `xml:"attributeGroup"`
}

type Documentation

type Documentation struct {
	XMLName  xml.Name `xml:"documentation"`
	Language string   `xml:"lang,attr"`
	Content  string   `xml:",innerxml"`
}

type Element

type Element struct {
	XMLName      xml.Name    `xml:"element"`
	Name         string      `xml:"name,attr"`
	Type         string      `xml:"type,attr"`
	Reference    string      `xml:"ref,attr"`
	Multiple     bool        `xml:"-"`
	StrMaxOccurs string      `xml:"maxOccurs,attr"`
	Nillable     bool        `xml:"nillable,attr"`
	Annotation   *Annotation `xml:"annotation"`
	SimpleType   *SimpleType `xml:"simpleType"`

	// This attr is specific to Trafikverket
	Key bool `xml:"key,attr"`
}

func (*Element) UnmarshalXML

func (e *Element) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Extension

type Extension struct {
	XMLName    xml.Name    `xml:"extension"`
	Base       string      `xml:"base,attr"`
	Attributes []Attribute `xml:"attribute"`
	Sequence   *Sequence   `xml:"sequence"`
}

type Restriction

type Restriction struct {
	XMLName      xml.Name    `xml:"restriction"`
	Base         string      `xml:"base,attr"`
	Attributes   []Attribute `xml:"attribute"`
	Enumerations []struct {
		Value string `xml:"value,attr"`
	} `xml:"enumeration"`
	SimpleContent *struct {
		Value string `xml:"value,attr"`
	} `xml:"simpleContent"`
	MinInclusive *struct {
		Value string `xml:"value,attr"`
	} `xml:"minInclusive"`
	MaxInclusive *struct {
		Value string `xml:"value,attr"`
	} `xml:"maxInclusive"`
	Pattern *struct {
		Value string `xml:"value,attr"`
	} `xml:"pattern"`
}

type Schema

type Schema struct {
	XMLName         xml.Name         `xml:"schema"`
	ComplexTypes    []ComplexType    `xml:"complexType"`
	SimpleTypes     []SimpleType     `xml:"simpleType"`
	AttributeGroups []AttributeGroup `xml:"attributeGroup"`
	Annotation      []Annotation     `xml:"annotation"`

	Meta meta.Data `xml:"-"`
}

func (*Schema) UnmarshalXML

func (s *Schema) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Sequence

type Sequence struct {
	XMLName      xml.Name    `xml:"sequence"`
	MinOccurs    int         `xml:"-"`
	MaxOccurs    int         `xml:"-"`
	Multiple     bool        `xml:"-"`
	StrMaxOccurs string      `xml:"maxOccurs,attr"`
	Elements     []Element   `xml:"element"`
	Annotation   *Annotation `xml:"annotation"`
}

func (*Sequence) UnmarshalXML

func (s *Sequence) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type SimpleContent

type SimpleContent struct {
	XMLName    xml.Name    `xml:"simpleContent"`
	Annotation *Annotation `xml:"annotation"`
	Extension  *Extension  `xml:"extension"`
}

type SimpleType

type SimpleType struct {
	XMLName     xml.Name    `xml:"simpleType"`
	Name        string      `xml:"name,attr"`
	Restriction Restriction `xml:"restriction"`
	Annotation  *Annotation `xml:"annotation"`
}

Jump to

Keyboard shortcuts

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