Documentation ¶
Index ¶
- func XMLEscape(s string) string
- type Attributes
- type Brackets
- func (b *Brackets) Add(name string, attrs ...Attributes) *Brackets
- func (b *Brackets) Append(other *Brackets) *Brackets
- func (b *Brackets) Close() *Brackets
- func (b *Brackets) CloseAll() *Brackets
- func (b *Brackets) Current() *Element
- func (b *Brackets) First() *Element
- func (b *Brackets) Last() *Element
- func (b *Brackets) Open(name string, attrs ...Attributes) *Brackets
- func (b *Brackets) String() string
- func (b *Brackets) Text(txt string) *Brackets
- type Element
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Attributes ¶
Attributes represents bracket attributes
func (Attributes) Clone ¶
func (am Attributes) Clone() Attributes
Clone creates a deep copy of a map
func (Attributes) Size ¶
func (am Attributes) Size() (size int)
Size calculates the total size in bytes of all keys + values
func (Attributes) String ¶
func (am Attributes) String() string
type Brackets ¶
type Brackets struct {
// contains filtered or unexported fields
}
Brackets is a simple xml-ish structure builder
func (*Brackets) Add ¶
func (b *Brackets) Add(name string, attrs ...Attributes) *Brackets
Add adds a self-closing element
func (*Brackets) Close ¶
Close closes the current element. If there are no children (elements or text), the current element will be self-closed. Otherwise, a matching close-element will be added.
func (*Brackets) Current ¶
Current returns a pointer to the currently open element, or nil if there is none.
func (*Brackets) First ¶ added in v0.3.0
First returns the first element of the underlying list of elements.
func (*Brackets) Last ¶
Last returns a pointer to the most recently added element, or nil if there is none.
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
Element represents an xml element
func (*Element) Attributes ¶
func (e *Element) Attributes() Attributes
Attributes returns a copy of the element attributes
func (*Element) SetAttribute ¶
SetAttribute resets an attribute to a new value