xml

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package xml provides an XSD-based dynamically typed xml decoder.

Index

Constants

View Source
const (
	StringType = iota
	IntType
	FloatType
	BoolType
)

Variables

This section is empty.

Functions

func Details

func Details(doc []byte) (map[string]Detail, error)

Details returns type and plurality details obtained from the provided XSD doc. Only interesting nodes are retained in the type hint tree. Interesting nodes are either plural, integer, float or bool, or have children at some depth that are plural, integer float or bool.

func Unmarshal

func Unmarshal(r io.Reader, details map[string]Detail) (cdata string, elems map[string]any, err error)

Unmarshal decodes the data in r using type and plurality hints in details. If details is nil, best effort plurality assessment will be made and all data will be represented as strings.

Types

type Detail

type Detail struct {
	// Type is the type of the tree node.
	Type Type
	// Plural is whether the node is a list.
	Plural bool

	// Children are the node's children.
	Children map[string]Detail
}

Detail is a type and plurality Detail node in a XSD tree.

type Type

type Type int

Type is an enriched JSON type system reflecting Go's treatment of it for numbers.

Jump to

Keyboard shortcuts

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