xmlutil

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToJSON

func ConvertToJSON(xmlStr string, newOpts ...ConvertToJSONOption) (string, error)

ConvertToJSON converts from xml to json

func LoadFile

func LoadFile(file string, v interface{}) error

LoadFile loads xml object from file

func LoadReader

func LoadReader(reader io.Reader, v interface{}) error

LoadReader loads xml object from reader

func SaveFile

func SaveFile(file string, v interface{}) error

SaveFile saves xml object to a file

func SaveFileIndent

func SaveFileIndent(file string, v interface{}, prefix, indent string) error

SaveFileIndent saves xml object to a file with indent

func SaveWriter

func SaveWriter(writer io.Writer, v interface{}) error

SaveWriter saves xml object to a writer

func SaveWriterIndent

func SaveWriterIndent(writer io.Writer, v interface{}, prefix, indent string) error

SaveWriterIndent save xml object to a writer with indent

Types

type ConvertToJSONOption

type ConvertToJSONOption func(*ConvertToJSONOptions) error

ConvertToJSONOption is a function on the options for a xml2json.

func WithIndent

func WithIndent(withIndent bool, prefix, indent string) ConvertToJSONOption

WithIndent ...

func WithRootElement

func WithRootElement(withRoot bool) ConvertToJSONOption

WithRootElement ...

type ConvertToJSONOptions

type ConvertToJSONOptions struct {
	WithIndent      bool   // well formatted json
	Prefix          string // the json marshal prefix
	Indent          string // the json marshal indent
	WithRootElement bool   // with the root element
}

ConvertToJSONOptions ...

func DefaultConvertToJSONOptions

func DefaultConvertToJSONOptions() *ConvertToJSONOptions

DefaultConvertToJSONOptions ...

Jump to

Keyboard shortcuts

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