x2j

package
v1.1.994 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2018 License: MIT, BSD-3-Clause, MIT Imports: 2 Imported by: 0

Documentation

Overview

x2j - For (mostly) backwards compatibility with legacy x2j package. Wrappers for end-to-end XML to JSON transformation and value manipulation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapToXml

func MapToXml(m map[string]interface{}) ([]byte, error)

map[string]interface{} --> ToXml()

func XmlLeafNodes

func XmlLeafNodes(xmlVal []byte) ([]LeafNode, error)

Wrap LeafNodes for XML. 'xmlVal' is an XML value

func XmlLeafPath

func XmlLeafPath(xmlVal []byte) ([]string, error)

Wrap LeafPath for XML. 'xmlVal' is an XML value

func XmlLeafValues

func XmlLeafValues(xmlVal []byte) ([]interface{}, error)

Wrap LeafValues for XML. 'xmlVal' is an XML value

func XmlNewJson

func XmlNewJson(xmlVal []byte, tagpairs ...string) ([]byte, error)

Wrap NewMap for XML and return as JSON 'xmlVal' is an XML value 'tagpairs' are "oldTag:newTag" values that conform to 'keypairs' in (Map)NewMap.

func XmlNewXml

func XmlNewXml(xmlVal []byte, tagpairs ...string) ([]byte, error)

Wrap NewMap for XML and return as XML 'xmlVal' is an XML value 'tagpairs' are "oldTag:newTag" values that conform to 'keypairs' in (Map)NewMap.

func XmlPathForTagShortest

func XmlPathForTagShortest(xmlVal []byte, tag string) (string, error)

Wrap PathForKeyShortest for XML.

func XmlPathsForTag

func XmlPathsForTag(xmlVal []byte, tag string) ([]string, error)

Wrap PathsForKey for XML.

func XmlReaderToJson

func XmlReaderToJson(xmlReader io.Reader, safeEncoding ...bool) ([]byte, []byte, error)

FromXmlReaderRaw() --> ToJson().

func XmlReaderToJsonWriter

func XmlReaderToJsonWriter(xmlReader io.Reader, jsonWriter io.Writer, safeEncoding ...bool) ([]byte, []byte, error)

FromXmlReader() --> ToJsonWriter(). Handy for bulk transformation of documents.

func XmlToJson

func XmlToJson(xmlVal []byte, safeEncoding ...bool) ([]byte, error)

FromXml() --> ToJson().

func XmlToJsonWriter

func XmlToJsonWriter(xmlVal []byte, jsonWriter io.Writer, safeEncoding ...bool) ([]byte, error)

FromXml() --> ToJsonWriterRaw().

func XmlToMap

func XmlToMap(xmlVal []byte) (map[string]interface{}, error)

FromXml() --> map[string]interface{}

func XmlUpdateValsForPath

func XmlUpdateValsForPath(xmlVal []byte, newTagValue interface{}, path string, subkeys ...string) ([]byte, error)

Wrap UpdateValuesForPath for XML

'xmlVal' is XML value
'newTagValue' is the value to replace an existing value at the end of 'path'
'path' is the dot-notation path with the tag whose value is to be replaced at the end
       (can include wildcard character, '*')
'subkeys' are key:value pairs of tag:values that must match for the tag

func XmlValuesForPath

func XmlValuesForPath(xmlVal []byte, path string, attrs ...string) ([]interface{}, error)

Wrap ValuesForPath for XML. 'attrs' are key:value pairs for attributes, where key is attribute label prepended with a hypen, '-'.

func XmlValuesForTag

func XmlValuesForTag(xmlVal []byte, tag string, attrs ...string) ([]interface{}, error)

Wrap ValuesForKey for XML. 'attrs' are key:value pairs for attributes, where key is attribute label prepended with a hypen, '-'.

Types

This section is empty.

Jump to

Keyboard shortcuts

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