-
Kyle Lemons authored
I have written up a Marshal and MarshalIndent pair that should closely reflect the way that Unmarshal works. I would love feedback on making this code more accessible and efficient... I haven't used reflecton on this scale before, so there is probably a lot of work that can be done on that. Some potentially controversial things: - All tag names are lower-cased by default. - Zero-valued struct values are skipped. - No namespace prefix (o:tag, etc) mechanism is supplied. - You are allowed to marshal non-struct values (even though unmarshal cannot handle them). - A tag for a non-XMLName struct field that isn't "attr", "chardata", or "innerxml" is used as the name of the tag. This could wreak havoc if you try to marshal a protobuf struct. - The "innerxml" and "chardata" are inserted verbatim. If you try to marshal something straight from unmarshal, the results could be unexpected (remove "innerxml" support from Marshal would be one possible solution). R=rsc CC=golang-dev https://golang.org/cl/4539082
abd50de2