xmlio

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: Apache-2.0 Imports: 12 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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalXML

func MarshalXML(m *wxx.Map_t, worldographerTargetVersion semver.Version) ([]byte, error)

MarshalXML uses the target version to pick the right XML schema, then converts the Map_t to XML. Returns an error for unsupported versions or if there are errors during the conversion.

func MarshalXMLBytes

func MarshalXMLBytes(m *wxx.Map_t) ([]byte, error)

Types

type Decoder

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

Decoder implements the wxx Decoder interface.

func NewDecoder

func NewDecoder(opts ...DecoderOption) *Decoder

NewDecoder returns a Decoder that implements the wxx.Decoder interface. Some features of the decoding pipeline can be configured with options.

func (*Decoder) Decode

func (d *Decoder) Decode(r io.Reader) (*wxx.Map_t, error)

Decode creates a Map_t from the input or returns an error.

type DecoderDiagnostics

type DecoderDiagnostics struct {
	Raw          []byte // original input
	Uncompressed []byte // input after running gunzip
	Converted    []byte // input after converting UTF-16 to UTF-8
	XMLHeader    []byte // XML header that was removed
	XMLData      []byte
	MapElement   []byte
	Schema       string
}

type DecoderOption

type DecoderOption func(*decoderOpts)

func WithDecoderDiagnostics

func WithDecoderDiagnostics(buf *DecoderDiagnostics) DecoderOption

WithDecoderDiagnostics captures data from each step of the decoding into buffers.

func WithFixXMLHeaderEncoding

func WithFixXMLHeaderEncoding(enabled bool) DecoderOption

WithFixXMLHeaderEncoding sets the flag for updating the encoding in the XML header.

func WithSkipUncompress

func WithSkipUncompress() DecoderOption

WithSkipUncompress skips the step for running gunzip on the input.

func WithUTF16BEInput

func WithUTF16BEInput(enabled bool) DecoderOption

WithUTF16BEInput sets the flag for running the UTF16/BE to UTF8 conversion on the input.

type Encoder

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

func NewEncoder

func NewEncoder(opts ...EncoderOption) *Encoder

NewEncoder returns an Encoder that implements the wxx.Encoder interface. Some features of the encoding pipeline can be configured with options.

func (*Encoder) Encode

func (e *Encoder) Encode(w io.Writer, worldographerTargetVersion semver.Version, m *wxx.Map_t) error

type EncoderDiagnostics

type EncoderDiagnostics struct {
	Utf8Encoded   []byte // output after marshaling to UTF-8 XML
	WithXmlHeader []byte // output after inserting XML header
	Utf16Encoded  []byte // output after converting UTF-8 to UTF-16
	Compressed    []byte // output after running gzip
	Schema        string
}

type EncoderOption

type EncoderOption func(*encoderOpts)

func WithEncoderDiagnostics

func WithEncoderDiagnostics(buf *EncoderDiagnostics) EncoderOption

WithEncoderDiagnostics captures data from each step of the decoding into buffers.

func WithGzipOutput

func WithGzipOutput(enabled bool) EncoderOption

func WithUTF16BEOutput

func WithUTF16BEOutput(enabled bool) EncoderOption

func WithXMLHeader

func WithXMLHeader(enabled bool) EncoderOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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