Documentation ¶
Overview ¶
Package gxml provides accessing and converting for XML content.
Index ¶
- func Decode(content []byte) (map[string]interface{}, error)
- func DecodeWithoutRoot(content []byte) (map[string]interface{}, error)
- func Encode(m map[string]interface{}, rootTag ...string) ([]byte, error)
- func EncodeWithIndent(m map[string]interface{}, rootTag ...string) ([]byte, error)
- func ToJson(content []byte) ([]byte, error)
- func XMLEscapeChars(b ...bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeWithoutRoot ¶
DecodeWithoutRoot parses `content` into a map, and returns the map without root level.
func Encode ¶
Encode encodes map `m` to an XML format content as bytes. The optional parameter `rootTag` is used to specify the XML root tag.
func EncodeWithIndent ¶
EncodeWithIndent encodes map `m` to an XML format content as bytes with indent. The optional parameter `rootTag` is used to specify the XML root tag.
func XMLEscapeChars ¶ added in v2.7.4
func XMLEscapeChars(b ...bool)
XMLEscapeChars forces escaping invalid characters in attribute and element values. NOTE: this is brute force with NO interrogation of '&' being escaped already; if it is then '&' will be re-escaped as '&'.
The values are: " " ' ' < < > > & &
Note: if XMLEscapeCharsDecoder(true) has been called - or the default, 'false,' value has been toggled to 'true' - then XMLEscapeChars(true) is ignored. If XMLEscapeChars(true) has already been called before XMLEscapeCharsDecoder(true), XMLEscapeChars(false) is called to turn escape encoding on mv.Xml, etc., to prevent double escaping ampersands, '&'.
Types ¶
This section is empty.