go - Golang: UnmarshalXMLAttr in encoding/xml -
I'm trying to disassociate some XMR, where I want to parse the attributes in a particular way. I have tried to use it, but I can not work it. Using the following code, I only get one output '{castle}' Any thoughts?
attribute unmarshaler should be a type of title , Not the show. Here is a definite version:
First of all, we create a "wrong type" that wraps the string and applies the interface
type Title string
We now define the title field as our type
This will call our attribute for this attribute
Show Type Structure {Title Title: `Xml:" Title, Atr " `}
and now our custom unmounted for:
Funk (S * title) UnmarshalXMLAttr (attr) Xml.Attr) error {fmt. Printf ("property '% s' parsing value '% s'", attr.Name.Local, attr.Value) * s = title (strings.toUpper (attr.Value)) returns blue}
The rest remains the same:
func main () {b: = [] byte (`
Comments
Post a Comment