Documentation ¶
Overview ¶
x2j - For (mostly) backwards compatibility with legacy x2j package. Wrappers for end-to-end XML to JSON transformation and value manipulation.
Index ¶
- func MapToXml(m map[string]interface{}) ([]byte, error)
- func XmlLeafNodes(xmlVal []byte) ([]LeafNode, error)
- func XmlLeafPath(xmlVal []byte) ([]string, error)
- func XmlLeafValues(xmlVal []byte) ([]interface{}, error)
- func XmlNewJson(xmlVal []byte, tagpairs ...string) ([]byte, error)
- func XmlNewXml(xmlVal []byte, tagpairs ...string) ([]byte, error)
- func XmlPathForTagShortest(xmlVal []byte, tag string) (string, error)
- func XmlPathsForTag(xmlVal []byte, tag string) ([]string, error)
- func XmlReaderToJson(xmlReader io.Reader, safeEncoding ...bool) ([]byte, []byte, error)
- func XmlReaderToJsonWriter(xmlReader io.Reader, jsonWriter io.Writer, safeEncoding ...bool) ([]byte, []byte, error)
- func XmlToJson(xmlVal []byte, safeEncoding ...bool) ([]byte, error)
- func XmlToJsonWriter(xmlVal []byte, jsonWriter io.Writer, safeEncoding ...bool) ([]byte, error)
- func XmlToMap(xmlVal []byte) (map[string]interface{}, error)
- func XmlUpdateValsForPath(xmlVal []byte, newTagValue interface{}, path string, subkeys ...string) ([]byte, error)
- func XmlValuesForPath(xmlVal []byte, path string, attrs ...string) ([]interface{}, error)
- func XmlValuesForTag(xmlVal []byte, tag string, attrs ...string) ([]interface{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func XmlLeafNodes ¶
Wrap LeafNodes for XML. 'xmlVal' is an XML value
func XmlLeafPath ¶
Wrap LeafPath for XML. 'xmlVal' is an XML value
func XmlLeafValues ¶
Wrap LeafValues for XML. 'xmlVal' is an XML value
func XmlNewJson ¶
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 ¶
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 ¶
Wrap PathForKeyShortest for XML.
func XmlPathsForTag ¶
Wrap PathsForKey for XML.
func XmlReaderToJson ¶
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 XmlToJsonWriter ¶
FromXml() --> ToJsonWriterRaw().
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 ¶
Wrap ValuesForPath for XML. 'attrs' are key:value pairs for attributes, where key is attribute label prepended with a hypen, '-'.
Types ¶
This section is empty.