package koala
import "cuelang.org/go/encoding/xml/koala"
Package koala converts XML to and from CUE, as described in the proposal for the koala encoding. This encoding is inspired by the BadgerFish convention for translating XML to JSON. It differs from this to better fit CUE syntax, (as "$" and "@" are special characters), and for improved readability, as described in the koala proposal.
XML elements are modeled as CUE structs, their attributes are modeled as struct fields prefixed with "$", and their inner text content is modeled as a field named "$$".
WARNING: THIS PACKAGE IS EXPERIMENTAL. ITS API MAY CHANGE AT ANY TIME.
Index ¶
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder implements the decoding state.
func NewDecoder ¶
NewDecoder creates a decoder from a stream of XML input.
func (*Decoder) Decode ¶
Decode parses the input stream as XML and converts it to a CUE ast.Expr. The input stream is taken from the Decoder and consumed.
Source Files ¶
decode.go
- Version
- v0.13.0-rc.1
- Published
- May 16, 2025
- Platform
- js/wasm
- Imports
- 8 packages
- Last checked
- 29 minutes ago –
Tools for package owners.