According to the docs, the library marshals according to the following
criteria:
The name for the XML elements is taken from, in order of preference:
- <snip>
- the name of the marshaled type
As a result, the library translates a sequence of slice elements of go
basic types into a sequence of xml elements with differing tags.
When unmarshaling into a go slice, the library doesn't have a criteria
to follow on how to unmarshal such sequence of xml elements.
I myself would rather see the lib throw an error during the marshaling
step. However, the lib works as intended as of now in the sense that:
- it doesn't promise a roundtrip-ing ability
- it follows its marshaling and unmarshaling criteria
Modifying the current marshaling steps would break go1compat
(https://golang.org/doc/go1compat).
On 21/06/17 11:19, Dat Huynh wrote:
Hi Kiki,
Ian has bought it back and I replied it.
Thanks,
Dat.
On Wed, Jun 21, 2017 at 10:58 AM, Kiki Sugiaman <ksugia...@gmail.com
<mailto:ksugia...@gmail.com>> wrote:
May I bring this email back into the mailing list so other people
could refer to it?
On 20/06/17 19:52, Dat Huynh wrote:
No worries.
It is actually a bug. I reported it here.
https://github.com/golang/go/issues/20735
<https://github.com/golang/go/issues/20735>
Regards,
Dat.
On Tue, Jun 20, 2017 at 7:49 PM, Kiki Sugiaman
<ksugia...@gmail.com <mailto:ksugia...@gmail.com>
<mailto:ksugia...@gmail.com <mailto:ksugia...@gmail.com>>> wrote:
Didn't realize that I replied only to you instead of the
mailing
list....apologies!
On 20/06/17 17:05, Kiki Sugiaman wrote:
In both cases, you unmarshal into a go slice.
[1,2,"Third element","2009-11-10T23:00:00Z",true]
... looks like an array
<int>1</int><float64>2</float64><string>Third
element</string><Time>2009-11-10T23:00:00Z</Time><bool>true</bool>
... does not
There is no bug in this case.
On 20/06/17 08:40, Dat Huynh wrote:
Hi all,
I am using the libraries "encoding/xml" and
"encoding/json"
to marshal and unmarshal a slice.
I wonder why the method Unmarshal in encoding/xml
does not
return a slice as what I have from encoding/json.
The below is my example.
https://play.golang.org/p/ZlALkyCbzX
<https://play.golang.org/p/ZlALkyCbzX>
<https://play.golang.org/p/ZlALkyCbzX
<https://play.golang.org/p/ZlALkyCbzX>>
Do I miss something or is this a bug of the library?
Thank you very much.
Sincerely,
Dat.
-- You received this message because
you are subscribed to the
Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving
emails
from it, send an email to
golang-nuts+unsubscr...@googlegroups.com
<mailto:golang-nuts%2bunsubscr...@googlegroups.com>
<mailto:golang-nuts%2bunsubscr...@googlegroups.com
<mailto:golang-nuts%252bunsubscr...@googlegroups.com>>
<mailto:golang-nuts+unsubscr...@googlegroups.com
<mailto:golang-nuts%2bunsubscr...@googlegroups.com>
<mailto:golang-nuts%2bunsubscr...@googlegroups.com
<mailto:golang-nuts%252bunsubscr...@googlegroups.com>>>.
For more options, visit
https://groups.google.com/d/optout
<https://groups.google.com/d/optout>
<https://groups.google.com/d/optout
<https://groups.google.com/d/optout>>.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.