A xmlBuilder serializes values from Go code to XML
encoder*xml.Encodernamespacesmap[string]string
buildList adds the value's list items to the current XMLNode as children nodes. All
nested values in the list are converted to XMLNodes also.
buildMap adds the value's key/value pairs to the current XMLNode as children nodes. All
nested values in the map are converted to XMLNodes also.
Error will be returned if it is unable to build the map's values into XMLNodes
buildScalar will convert the value into a string and append it as a attribute or child
of the current XMLNode.
The value will be added as an attribute if tag contains a "xmlAttribute" attribute value.
Error will be returned if the value type is unsupported.
buildStruct adds a struct and its fields to the current XMLNode. All fields and any nested
types are converted to XMLNodes also.
buildValue generic XMLNode builder for any type. Will build value for their specific type
struct, list, map, scalar.
Also takes a "type" tag value to set what type a value should be converted to XMLNode as. If
type is not provided reflect will be used to determine the value's type.
Package-Level Functions (total 14, in which 6 are exported)
BuildXML will serialize params into an xml.Encoder. Error will be returned
if the serialization of any of the params or nested values fails.
NewXMLElement returns a pointer to a new XMLNode initialized to default values.
StructToXML writes an XMLNode to a xml.Encoder as tokens.
UnmarshalXML deserializes an xml.Decoder into the container v. V
needs to match the shape of the XML expected to be decoded.
If the shape doesn't match unmarshaling will fail.
UnmarshalXMLError unmarshals the XML error from the stream into the value
type specified. The value must be a pointer. If the message fails to
unmarshal, the message content will be included in the returned error as a
awserr.UnmarshalError.
XMLToStruct converts a xml.Decoder stream to XMLNode with nested values.
Returns the reflection element of a value, if it is a pointer.
parse deserializes any value from the XMLNode. The type tag is used to infer the type, or reflect
will be used to determine the type from r.
parseList deserializes a list of values from an XML node. Each list entry
will also be deserialized.
parseMap deserializes a map from an XMLNode. The direct children of the XMLNode
will also be deserialized as map entries.
parseMapEntry deserializes a map entry from a XML node.
parseScaller deserializes an XMLNode value into a concrete type based on the
interface type of r.
Error is returned if the deserialization fails due to invalid type conversion,
or unsupported interface type.
parseStruct deserializes a structure and its fields from an XMLNode. Any nested
types in the structure will also be deserialized.
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.