FAQ
https://codereview.appspot.com/6858067/diff/3004/src/pkg/encoding/xml/typeinfo.go
File src/pkg/encoding/xml/typeinfo.go (right):

https://codereview.appspot.com/6858067/diff/3004/src/pkg/encoding/xml/typeinfo.go#newcode51
src/pkg/encoding/xml/typeinfo.go:51: // XmlCodec is the interface
describing data that provides its own
This should probably be split - many people are only doing one or the
other operation. Also, we've cleaned up this package once to have an API
paralleling encoding/json. We should probably follow it here too, so
this would be two types Marshaler and Unmarshaler with methods
MarshalXML and UnmarshalXML.

Probably the methods need to be passed a flag saying whether to
expect/produce an attribute string or a real XML value. There is also a
detail about the outer tag to consider.

https://codereview.appspot.com/6858067/

Search Discussions

  • Nightlyone at Dec 11, 2012 at 9:56 pm
    https://codereview.appspot.com/6858067/diff/3004/src/pkg/encoding/xml/typeinfo.go
    File src/pkg/encoding/xml/typeinfo.go (right):

    https://codereview.appspot.com/6858067/diff/3004/src/pkg/encoding/xml/typeinfo.go#newcode51
    src/pkg/encoding/xml/typeinfo.go:51: // XmlCodec is the interface
    describing data that provides its own
    On 2012/12/11 18:34:15, rsc wrote:
    [...] so this would be two types
    Marshaler and Unmarshaler with methods MarshalXML and UnmarshalXML. Done.
    Probably the methods need to be passed a flag saying whether to
    expect/produce
    an attribute string or a real XML value.
    Actually this would be "chardata", "innerxml", "attr" and even
    "comment". They need to marshal very different and the implementer
    usually only needs one of them.

    So I see two solutions:
    a) Use four interfaces
    b) Pass along an exported version field mode (fAttr, fChardata, etc) and
    define an error type to report, that we cannot encode our field this
    way.

    Currently implemented is "innerxml".
    There is also a detail about the outer
    tag to consider.
    Could you be a bit more specific here?

    https://codereview.appspot.com/6858067/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedDec 11, '12 at 6:34p
activeDec 11, '12 at 9:56p
posts2
users2
websitegolang.org

2 users in discussion

Rsc: 1 post Nightlyone: 1 post

People

Translate

site design / logo © 2021 Grokbase