xsd

package
v0.1.3-0...-d7886aa Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2021 License: Unlicense Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsStaticType

func IsStaticType(name string) bool

func StaticType

func StaticType(name string) staticType

Types

type Attribute

type Attribute struct {
	XMLName        xml.Name  `xml:"http://www.w3.org/2001/XMLSchema attribute"`
	Name           string    `xml:"name,attr"`
	Type           reference `xml:"type,attr"`
	Use            string    `xml:"use,attr"`
	DuplicateCount uint      `xml:"-"`
	Ref            reference `xml:"ref,attr"`
	// contains filtered or unexported fields
}

Attribute defines single XML attribute

func (*Attribute) GoForeignModule

func (a *Attribute) GoForeignModule() string

func (*Attribute) GoName

func (a *Attribute) GoName() string

Public Go Name of this struct item

func (*Attribute) GoType

func (a *Attribute) GoType() string

func (*Attribute) Modifiers

func (a *Attribute) Modifiers() string

func (*Attribute) XmlName

func (a *Attribute) XmlName() string

type AttributeGroup

type AttributeGroup struct {
	XMLName          xml.Name    `xml:"http://www.w3.org/2001/XMLSchema attributeGroup"`
	Name             string      `xml:"name,attr"`
	Ref              reference   `xml:"ref,attr"`
	AttributesDirect []Attribute `xml:"attribute"`
	// contains filtered or unexported fields
}

func (*AttributeGroup) Attributes

func (att *AttributeGroup) Attributes() []Attribute

func (*AttributeGroup) ContainsText

func (att *AttributeGroup) ContainsText() bool

func (*AttributeGroup) Elements

func (att *AttributeGroup) Elements() []Element

func (*AttributeGroup) GoName

func (att *AttributeGroup) GoName() string

func (*AttributeGroup) GoTypeName

func (att *AttributeGroup) GoTypeName() string

func (*AttributeGroup) Schema

func (att *AttributeGroup) Schema() *Schema

type Choice

type Choice struct {
	XMLName     xml.Name   `xml:"http://www.w3.org/2001/XMLSchema choice"`
	MinOccurs   string     `xml:"minOccurs,attr"`
	MaxOccurs   string     `xml:"maxOccurs,attr"`
	ElementList []Element  `xml:"element"`
	Sequences   []Sequence `xml:"sequence"`
	// contains filtered or unexported fields
}

func (*Choice) Elements

func (c *Choice) Elements() []Element

type ComplexContent

type ComplexContent struct {
	XMLName     xml.Name     `xml:"http://www.w3.org/2001/XMLSchema complexContent"`
	Extension   *Extension   `xml:"extension"`
	Restriction *Restriction `xml:"restriction"`
	// contains filtered or unexported fields
}

func (*ComplexContent) Attributes

func (cc *ComplexContent) Attributes() []Attribute

func (*ComplexContent) ContainsText

func (cc *ComplexContent) ContainsText() bool

func (*ComplexContent) Elements

func (cc *ComplexContent) Elements() []Element

type ComplexType

type ComplexType struct {
	XMLName          xml.Name    `xml:"http://www.w3.org/2001/XMLSchema complexType"`
	Name             string      `xml:"name,attr"`
	Mixed            bool        `xml:"mixed,attr"`
	AttributesDirect []Attribute `xml:"attribute"`
	Sequence         *Sequence   `xml:"sequence"`

	SimpleContent  *SimpleContent  `xml:"simpleContent"`
	ComplexContent *ComplexContent `xml:"complexContent"`
	Choice         *Choice         `xml:"choice"`
	// contains filtered or unexported fields
}

func (*ComplexType) Attributes

func (ct *ComplexType) Attributes() []Attribute

func (*ComplexType) ContainsText

func (ct *ComplexType) ContainsText() bool

func (*ComplexType) Elements

func (ct *ComplexType) Elements() []Element

func (*ComplexType) GoName

func (ct *ComplexType) GoName() string

func (*ComplexType) GoTypeName

func (ct *ComplexType) GoTypeName() string

func (*ComplexType) HasXmlNameAttribute

func (ct *ComplexType) HasXmlNameAttribute() bool

func (*ComplexType) Schema

func (ct *ComplexType) Schema() *Schema

type Element

type Element struct {
	XMLName xml.Name `xml:"http://www.w3.org/2001/XMLSchema element"`
	Name    string   `xml:"name,attr"`

	XmlNameOverride string    `xml:"-"`
	FieldOverride   bool      `xml:"-"`
	Type            reference `xml:"type,attr"`
	Ref             reference `xml:"ref,attr"`
	MinOccurs       string    `xml:"minOccurs,attr"`
	MaxOccurs       string    `xml:"maxOccurs,attr"`

	ComplexType *ComplexType `xml:"complexType"`
	SimpleType  *SimpleType  `xml:"simpleType"`
	// contains filtered or unexported fields
}

Element defines single XML element

func (*Element) Attributes

func (e *Element) Attributes() []Attribute

func (*Element) ContainsText

func (e *Element) ContainsText() bool

func (*Element) Elements

func (e *Element) Elements() []Element

func (*Element) GoFieldName

func (e *Element) GoFieldName() string

func (*Element) GoForeignModule

func (e *Element) GoForeignModule() string

func (*Element) GoMemLayout

func (e *Element) GoMemLayout() string

func (*Element) GoName

func (e *Element) GoName() string

func (*Element) GoTypeName

func (e *Element) GoTypeName() string

func (*Element) XmlName

func (e *Element) XmlName() string

type Enumeration

type Enumeration struct {
	XMLName xml.Name `xml:"http://www.w3.org/2001/XMLSchema enumeration"`
	Value   string   `xml:"value,attr"`
}

Attribute defines single XML attribute

func (*Enumeration) GoName

func (e *Enumeration) GoName() string

Public Go Name of this struct item

func (*Enumeration) Modifiers

func (e *Enumeration) Modifiers() string

func (*Enumeration) XmlName

func (e *Enumeration) XmlName() string

type Extension

type Extension struct {
	XMLName          xml.Name         `xml:"http://www.w3.org/2001/XMLSchema extension"`
	Base             reference        `xml:"base,attr"`
	AttributesDirect []Attribute      `xml:"attribute"`
	AttributeGroups  []AttributeGroup `xml:"attributeGroup"`
	Sequence         *Sequence        `xml:"sequence"`
	// contains filtered or unexported fields
}

func (*Extension) Attributes

func (ext *Extension) Attributes() []Attribute

func (*Extension) ContainsText

func (ext *Extension) ContainsText() bool

func (*Extension) Elements

func (ext *Extension) Elements() []Element

type GenericContent

type GenericContent interface {
	Attributes() []Attribute
	Elements() []Element
	ContainsText() bool
	// contains filtered or unexported methods
}

type Import

type Import struct {
	XMLName        xml.Name `xml:"http://www.w3.org/2001/XMLSchema import"`
	Namespace      string   `xml:"namespace,attr"`
	SchemaLocation string   `xml:"schemaLocation,attr"`
	ImportedSchema *Schema  `xml:"-"`
}

type Restriction

type Restriction struct {
	XMLName          xml.Name       `xml:"http://www.w3.org/2001/XMLSchema restriction"`
	Base             reference      `xml:"base,attr"`
	AttributesDirect []Attribute    `xml:"attribute"`
	EnumsDirect      []Enumeration  `xml:"enumeration"`
	SimpleContent    *SimpleContent `xml:"simpleContent"`
	// contains filtered or unexported fields
}

func (*Restriction) Attributes

func (r *Restriction) Attributes() []Attribute

func (*Restriction) Enums

func (r *Restriction) Enums() []Enumeration

type Schema

type Schema struct {
	XMLName         xml.Name         `xml:"http://www.w3.org/2001/XMLSchema schema"`
	Xmlns           Xmlns            `xml:"-"`
	TargetNamespace string           `xml:"targetNamespace,attr"`
	Imports         []Import         `xml:"import"`
	Elements        []Element        `xml:"element"`
	Attributes      []Attribute      `xml:"attribute"`
	AttributeGroups []AttributeGroup `xml:"attributeGroup"`
	ComplexTypes    []ComplexType    `xml:"complexType"`
	SimpleTypes     []SimpleType     `xml:"simpleType"`

	ModulesPath string `xml:"-"`
	// contains filtered or unexported fields
}

Schema is the root XSD element

func ParseSchema

func ParseSchema(f io.Reader) (*Schema, error)

func (*Schema) Empty

func (sch *Schema) Empty() bool

func (*Schema) ExportableComplexTypes

func (sch *Schema) ExportableComplexTypes() []ComplexType

func (*Schema) ExportableElements

func (sch *Schema) ExportableElements() []Element

func (*Schema) ExportableSimpleTypes

func (sch *Schema) ExportableSimpleTypes() []SimpleType

func (*Schema) GetAttribute

func (sch *Schema) GetAttribute(name string) *Attribute

func (*Schema) GetElement

func (sch *Schema) GetElement(name string) *Element

func (*Schema) GetType

func (sch *Schema) GetType(name string) Type

func (*Schema) GoImportsNeeded

func (sch *Schema) GoImportsNeeded() []string

func (*Schema) GoPackageName

func (sch *Schema) GoPackageName() string

func (*Schema) UnmarshalXML

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

type Sequence

type Sequence struct {
	XMLName     xml.Name  `xml:"http://www.w3.org/2001/XMLSchema sequence"`
	ElementList []Element `xml:"element"`
	Choices     []Choice  `xml:"choice"`
	// contains filtered or unexported fields
}

func (*Sequence) Elements

func (s *Sequence) Elements() []Element

type SimpleContent

type SimpleContent struct {
	XMLName     xml.Name     `xml:"http://www.w3.org/2001/XMLSchema simpleContent"`
	Extension   *Extension   `xml:"extension"`
	Restriction *Restriction `xml:"restriction"`
	// contains filtered or unexported fields
}

func (*SimpleContent) Attributes

func (sc *SimpleContent) Attributes() []Attribute

func (*SimpleContent) ContainsText

func (sc *SimpleContent) ContainsText() bool

func (*SimpleContent) Elements

func (sc *SimpleContent) Elements() []Element

type SimpleType

type SimpleType struct {
	XMLName     xml.Name     `xml:"http://www.w3.org/2001/XMLSchema simpleType"`
	Name        string       `xml:"name,attr"`
	Restriction *Restriction `xml:"restriction"`
	// contains filtered or unexported fields
}

func (*SimpleType) Attributes

func (st *SimpleType) Attributes() []Attribute

func (*SimpleType) ContainsText

func (st *SimpleType) ContainsText() bool

func (*SimpleType) Elements

func (st *SimpleType) Elements() []Element

func (*SimpleType) Enums

func (st *SimpleType) Enums() []Enumeration

func (*SimpleType) GoName

func (st *SimpleType) GoName() string

func (*SimpleType) GoTypeName

func (st *SimpleType) GoTypeName() string

func (*SimpleType) Schema

func (st *SimpleType) Schema() *Schema

type Type

type Type interface {
	GoName() string
	GoTypeName() string
	Schema() *Schema
	Attributes() []Attribute
	Elements() []Element
	ContainsText() bool
	// contains filtered or unexported methods
}

type Workspace

type Workspace struct {
	Cache         map[string]*Schema
	GoModulesPath string
}

func NewWorkspace

func NewWorkspace(goModulesPath, xsdPath string) (*Workspace, error)

type Xmlns

type Xmlns []XmlnsAttr

func (Xmlns) PrefixByUri

func (declarations Xmlns) PrefixByUri(uri string) string

func (Xmlns) UriByPrefix

func (declarations Xmlns) UriByPrefix(prefix string) string

type XmlnsAttr

type XmlnsAttr struct {
	Prefix string
	Uri    string
}

Jump to

Keyboard shortcuts

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