Documentation

Overview

Package iter provides a streaming iterator over an XML elements children.

This will likely be moved to mellium.im/xmlstream once the API is finalized.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Iter

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

Iter provides a mechanism for streaming the children of an XML element. Successive calls to the Next method will step through each child, returning its start element and a reader that is limited to the remainder of the child.

func New

func New(r xml.TokenReader) *Iter

New returns a new iterator that iterates over the children of the most recent start element already consumed from r.

func (*Iter) Close

func (i *Iter) Close() error

Close indicates that we are finished with the given iterator. Calling it multiple times has no effect.

If the underlying TokenReader is also an io.Closer, Close calls the readers Close method.

func (*Iter) Current

func (i *Iter) Current() (*xml.StartElement, xml.TokenReader)

Current returns a reader over the most recent child.

func (*Iter) Err

func (i *Iter) Err() error

Err returns the last error encountered by the iterator (if any).

func (*Iter) Next

func (i *Iter) Next() bool

Next returns true if there are more items to decode.

Source Files