xmlvector

package module
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: MIT Imports: 9 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

XML vector

XML parser based on Vector API with minimum memory consumption.

Usage
src := []byte(`<?xml version="1.0" encoding="UTF-8"?>
<俄语 լեզու="ռուսերեն">данные</俄语>`)
vec := xmlvector.Acquire()
defer xmlvector.Release(vec)
_ = vec.Parse(src)
fmt.Println(vec.Dot("俄语@լեզու")) // ռուսերեն

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadAttr     = errors.New("bad attribute")
	ErrNoRoot      = errors.New("no root tag")
	ErrUnclosedTag = errors.New("unclosed tag")
	ErrUnexpToken  = errors.New("unexpected token")
)

Functions

func Release

func Release(vec *Vector)

Release puts vector back to default pool instance.

func ReleaseNC added in v1.0.3

func ReleaseNC(vec *Vector)

ReleaseNC puts vector back to pool with enforced no-clear flag.

func Unescape

func Unescape(p []byte) []byte

Unescape byte array using itself as a destination.

Types

type Helper

type Helper struct{}

func (Helper) Beautify

func (h Helper) Beautify(w io.Writer, node *vector.Node) error

func (Helper) Indirect

func (h Helper) Indirect(p *vector.Byteptr) []byte

func (Helper) Marshal added in v1.0.2

func (h Helper) Marshal(w io.Writer, node *vector.Node) error

type Pool

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

Pool represents JSON vectors pool.

func (*Pool) Get

func (p *Pool) Get() *Vector

Get old vector from the pool or create new one.

func (*Pool) Put

func (p *Pool) Put(vec *Vector)

Put vector back to the pool.

type Vector

type Vector struct {
	vector.Vector
}

Vector implements XML vector parser.

func Acquire

func Acquire() *Vector

Acquire returns vector from default pool instance.

func NewVector

func NewVector() *Vector

NewVector makes new parser.

func (*Vector) Parse

func (vec *Vector) Parse(s []byte) error

Parse parses source bytes.

func (*Vector) ParseCopy

func (vec *Vector) ParseCopy(s []byte) error

ParseCopy copies source bytes and parse it.

func (*Vector) ParseCopyStr

func (vec *Vector) ParseCopyStr(s string) error

ParseCopyStr copies source string and parse it. DEPRECATED: use ParseCopyString instead.

func (*Vector) ParseCopyString added in v1.0.6

func (vec *Vector) ParseCopyString(s string) error

ParseCopyString copies source string and parse it.

func (*Vector) ParseFile added in v1.0.5

func (vec *Vector) ParseFile(path string) error

ParseFile reads file contents and parse it.

func (*Vector) ParseReader added in v1.0.5

func (vec *Vector) ParseReader(r io.Reader) error

ParseReader reads source from r and parse it.

func (*Vector) ParseStr

func (vec *Vector) ParseStr(s string) error

ParseStr parses source string. DEPRECATED: use ParseString instead.

func (*Vector) ParseString added in v1.0.6

func (vec *Vector) ParseString(s string) error

ParseString parses source string.

Jump to

Keyboard shortcuts

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