xtream

package module
v0.0.0-...-9b6ded8 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2015 License: BSD-3-Clause Imports: 5 Imported by: 13

README

xtream

Build Status GoDoc

This is a library which allows to plug structs into XML unmarshaling tree. So as result you can parse arbitrary XML by plugging more specific structures describing some parts of this XML document on-demand.

TODO: add examples and better explanation

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NodeFactory = NewFactory()

Functions

func NewElements

func NewElements() *elements

func NewFactory

func NewFactory() *outerNodesFactory

Types

type Constructor

type Constructor func() Element

type Element

type Element interface{}

type Factory

type Factory interface {
	// Register cons as a constructor for an element named inner, inside an element named outer
	Add(cons Constructor)
	AddNamed(cons Constructor, outer, inner xml.Name)

	// Construct an element named inner for an outer element named outer
	Get(outer, inner *xml.Name) Element
}

Factory pattern interface with a two-level match (outer, inner) of constructors

type InnerElements

type InnerElements interface {
	Elements() []Element
	AddElement(Element)
	Registrable
}

type InnerXML

type InnerXML struct {
	XMLName xml.Name
	XML     string `xml:",innerxml"`
}

type Registrable

type Registrable interface {
	SetFactory(Factory)
	SetXMLName(*xml.Name)
}

Jump to

Keyboard shortcuts

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