xpp

package module
v0.0.0-...-751479c Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: MIT Imports: 5 Imported by: 0

README

goxpp

Build Status Coverage Status License GoDoc

The goxpp library is an XML parser library that is loosely based on the Java XMLPullParser. This library allows you to easily parse arbitary XML content using a pull parser. You can think of goxpp as a lightweight wrapper around Go's XML Decoder that provides a set of functions that make it easier to parse XML content than using the raw decoder itself.

This project is licensed under the MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type XMLEventType

type XMLEventType int
const (
	StartDocument XMLEventType = iota
	EndDocument
	StartTag
	EndTag
	Text
	Comment
	ProcessingInstruction
	Directive
	IgnorableWhitespace // TODO: ?

)

type XMLPullParser

type XMLPullParser struct {
	// Document State
	Spaces      map[string]string
	SpacesStack []map[string]string

	// Token State
	Depth int
	Event XMLEventType
	Attrs []xml.Attr
	Name  string
	Space string
	Text  string

	Decoder *xml.Decoder
	// contains filtered or unexported fields
}

func NewXMLPullParser

func NewXMLPullParser(r io.Reader, strict bool) *XMLPullParser

func (*XMLPullParser) Attribute

func (p *XMLPullParser) Attribute(name string) string

func (*XMLPullParser) DecodeElement

func (p *XMLPullParser) DecodeElement(v interface{}) error

func (*XMLPullParser) EventName

func (p *XMLPullParser) EventName(e XMLEventType) (name string)

func (*XMLPullParser) EventType

func (p *XMLPullParser) EventType(t xml.Token) (event XMLEventType)

func (*XMLPullParser) Expect

func (p *XMLPullParser) Expect(event XMLEventType, name string) (err error)

func (*XMLPullParser) ExpectAll

func (p *XMLPullParser) ExpectAll(event XMLEventType, space string, name string) (err error)

func (*XMLPullParser) IsWhitespace

func (p *XMLPullParser) IsWhitespace() bool

func (*XMLPullParser) Next

func (p *XMLPullParser) Next() (event XMLEventType, err error)

func (*XMLPullParser) NextTag

func (p *XMLPullParser) NextTag() (event XMLEventType, err error)

func (*XMLPullParser) NextText

func (p *XMLPullParser) NextText() (string, error)

func (*XMLPullParser) NextToken

func (p *XMLPullParser) NextToken() (event XMLEventType, err error)

func (*XMLPullParser) Skip

func (p *XMLPullParser) Skip() error

Jump to

Keyboard shortcuts

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