xqml

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2023 License: MIT Imports: 7 Imported by: ? modules, 0 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

View Source
const (
	ContentNone = iota
	ContentValue
	ContentObject
)
View Source
const (
	DefaultRootTag    = "root"
	DefaultElementTag = "element"
)

Variables

This section is empty.

Functions

func Stringify

func Stringify(v any) string

func ToJson added in v0.0.6

func ToJson(b []byte) (map[string]any, error)

Types

type Xqml

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

func NewXQML

func NewXQML() *Xqml

func (*Xqml) ParseXml

func (x *Xqml) ParseXml(reader io.Reader, cast bool) (map[string]any, error)

func (*Xqml) SetReadAttributes added in v0.0.3

func (x *Xqml) SetReadAttributes(b bool)

SetReadAttributes allows to keep attributes. Default is to keep attributes, use SetReadAttributes(false) to remove them.

func (*Xqml) SetReadDecoder added in v0.0.3

func (x *Xqml) SetReadDecoder(e *xml.Decoder)

SetReadDecoder allows to set a customer xml decoder. Default decoder has Strict = true and Entity = xml.HTMLEntity.

func (*Xqml) SetReadForceList added in v0.0.3

func (x *Xqml) SetReadForceList(s ...string)

SetReadForceList allows to ensure some elements are parsed as slice, even when only one element is present. Use "x" for element name at any path, or "r.x" path. Also supports multiple commma separated paths at once, like "a.b,a.c,d".

func (*Xqml) SetReadHtml added in v0.0.3

func (x *Xqml) SetReadHtml(b bool)

SetReadHtml allows to manage HTML content, by auto-closing known HTML tags. Default is to not manage HTML content.

func (*Xqml) SetReadNamespaces added in v0.0.5

func (x *Xqml) SetReadNamespaces(b bool)

SetReadNamespaces allows to keep namespaces. Default is to keep namespaces, use SetReadNamespaces(false) to remove them.

func (*Xqml) SetReadPartials added in v0.0.3

func (x *Xqml) SetReadPartials(b bool)

SetReadPartials allow to call ParseXml multiple times and return multiple XML files

func (*Xqml) SetWriteElement added in v0.0.3

func (x *Xqml) SetWriteElement(s string)

SetWriteElement allows to set default element tag name in <root><element>...</element></root>. It used only with WriteXml([]value).

func (*Xqml) SetWriteEncoder added in v0.0.3

func (x *Xqml) SetWriteEncoder(e *xml.Encoder)

SetWriteEncoder allows to set a customer xml encoder.

func (*Xqml) SetWriteIndent added in v0.0.3

func (x *Xqml) SetWriteIndent(s string)

SetWriteIndent allows to set indent string. Use "" for compact write.

func (*Xqml) SetWriteRoot added in v0.0.3

func (x *Xqml) SetWriteRoot(s string)

SetWriteRoot allows to set default element tag name in <root>...</root>. It used only with WriteXml(value).

func (*Xqml) WriteXml

func (x *Xqml) WriteXml(writer io.Writer, value any) error

Jump to

Keyboard shortcuts

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