Back to godoc.org

Package iter

v0.16.0
Latest Go to latest

The latest major version is .

Published: Mar 8, 2020 | License: BSD-2-Clause | Module: mellium.im/xmpp

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

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.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier