Documentation
¶
Index ¶
Constants ¶
const ( DefaultRootTag = "root" DefaultElementTag = "element" )
const ( ContentNone = iota ContentValue ContentObject )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Decoder ¶ added in v0.0.8
type Decoder struct {
// Attributes allows to keep attributes. Default is true.
Attributes bool
// Namespaces allows to keep namespaces. Default is true.
Namespaces bool
// ForceList allows to force some elements to be parsed as slices, even when only one element is present.
// Supports "r.x" paths notation and "x" element names. Multiple values can be passed as comma separated values, like "r.x,r.y,z".
ForceList []string
// Html allows HTML content, by auto-closing known HTML tags. Default is false.
Html bool
// Partials allow to call Decode() multiple times to return multiple XML files. When true, Decode() can be called until io.EOF is reached. Default is false.
Partials bool
// Cast allows to cast values to boolean/int/float. Default is true.
Cast bool
// Sep allows to set text separator between multiple CDATA. Default is " ".
Sep string
// contains filtered or unexported fields
}
func NewDecoder ¶ added in v0.0.8
NewDecoder returns a new decoder that reads from r.
The decoder introduces its own buffering and may read data from r beyond the XML values requested.
type Encoder ¶ added in v0.0.8
type Encoder struct {
// Indent allows to set output indentation. Default is "".
Indent string
// Root allows to set root element name. Default is "root".
Root string
// Element allows to set root.element element name. Default is "element".
Element string
// contains filtered or unexported fields
}
func NewEncoder ¶ added in v0.0.8
NewEncoder returns a new encoder that writes to w. The Encoder should be closed after use to flush all data to w.