FAQ
Hello,

  I am attempting to marshal/unmarshal some xml that has dates with a custom
date format.
I created a wrapper struct for time.Time and implemented MarshalXML and
UnmarshalXML and everything was fine until I had a struct with an attribute.

https://gist.github.com/msingle/bdc07a8bb9c211fcf4e9

If I have xml like this

<BeginDate>{{date}}</BeginDate>

it works as expected,
but if i have

<BeginDate some="attr">{{date}}</BeginDate>

and the struct is something like this

type BeginDate struct {
         Attr_Types string `xml:" some,attr" json:",omitempty"`
         Date WrapTime `xml:",chardata" json:",omitempty"`
}
the date is not formatted as I would expect when it is chardata

Is there something I'm not seeing here?

Thanks for any help!



--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 4 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedApr 21, '15 at 4:48p
activeApr 21, '15 at 7:52p
posts4
users3
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase