This assumes that boolean unmarshalling is broken. It's behaving exactly as the doc comment says: ...
14 years, 2 months ago
(2010-02-22 17:49:25 UTC)
#2
This assumes that boolean unmarshalling is broken.
It's behaving exactly as the doc comment says:
// Unmarshal maps an XML element to a bool by setting the bool to true.
I did this so that you can use a bool to tell whether
an element is there at all. Whether that's correct
behavior might be debated, but that makes this not
a bug fix but a package change.
Russ
I think it's very common for schemas to include boolean elements as "true" or "false" ...
14 years, 2 months ago
(2010-02-22 17:58:32 UTC)
#3
I think it's very common for schemas to include boolean elements as "true" or
"false" : http://www.w3.org/TR/xmlschema-2/#boolean
On 2010/02/22 17:49:25, rsc wrote:
> This assumes that boolean unmarshalling is broken.
> It's behaving exactly as the doc comment says:
>
> // Unmarshal maps an XML element to a bool by setting the bool to true.
>
> I did this so that you can use a bool to tell whether
> an element is there at all. Whether that's correct
> behavior might be debated, but that makes this not
> a bug fix but a package change.
>
> Russ
>
that's fine. i don't mind changing it, as long as the docs change, which you've ...
14 years, 2 months ago
(2010-02-22 22:32:22 UTC)
#5
that's fine.
i don't mind changing it, as long as the docs change,
which you've done.
the url you pointed at says that true and 1 are both
valid booleans. you should probably add "1".
done, and updated the docs. On 2010/02/22 22:32:22, rsc wrote: > that's fine. > i ...
14 years, 2 months ago
(2010-02-22 23:00:00 UTC)
#6
done, and updated the docs.
On 2010/02/22 22:32:22, rsc wrote:
> that's fine.
> i don't mind changing it, as long as the docs change,
> which you've done.
>
> the url you pointed at says that true and 1 are both
> valid booleans. you should probably add "1".
*** Submitted as http://code.google.com/p/go/source/detail?r=c040d89a73f7 *** xml: treat bool as value in Unmarshal R=rsc CC=golang-dev http://codereview.appspot.com/218050 ...
14 years, 2 months ago
(2010-02-22 23:21:16 UTC)
#9
Sorry to drag things back from the dead, but I'm trying to unmarshal a node ...
10 years, 8 months ago
(2013-08-18 06:02:21 UTC)
#10
Sorry to drag things back from the dead, but I'm trying to unmarshal a node
in the "original" way.
The node is "<b/>" and it's either there or not, so I wanted to use a
boolean to denote its presence. Except now it needs the string true or
false in there. There's no custom Unmarshaler support like in
encoding/json, so I'm not sure the best way to accomplish this.
Thoughts?
- Daniel
On Monday, February 22, 2010 10:58:32 AM UTC-7, hoi...@gmail.com wrote:
>
> I think it's very common for schemas to include boolean elements as
> "true" or "false" : http://www.w3.org/TR/xmlschema-2/#boolean
>
>
> On 2010/02/22 17:49:25, rsc wrote:
> > This assumes that boolean unmarshalling is broken.
> > It's behaving exactly as the doc comment says:
>
> > // Unmarshal maps an XML element to a bool by setting the bool to
> true.
>
> > I did this so that you can use a bool to tell whether
> > an element is there at all. Whether that's correct
> > behavior might be debated, but that makes this not
> > a bug fix but a package change.
>
> > Russ
>
>
> http://codereview.appspot.com/218050/show
>
>
There's support for custom (un)marshaling in encoding/xml since around CL 12556043. On 2013/08/18 06:02:21, darkhelmet_darkhelmetlive.com ...
10 years, 8 months ago
(2013-08-18 15:48:51 UTC)
#11
Message was sent while issue was closed.
There's support for custom (un)marshaling in encoding/xml since around CL
12556043.
On 2013/08/18 06:02:21, darkhelmet_darkhelmetlive.com wrote:
> Sorry to drag things back from the dead, but I'm trying to unmarshal a node
> in the "original" way.
>
> The node is "<b/>" and it's either there or not, so I wanted to use a
> boolean to denote its presence. Except now it needs the string true or
> false in there. There's no custom Unmarshaler support like in
> encoding/json, so I'm not sure the best way to accomplish this.
>
> Thoughts?
>
> - Daniel
>
> On Monday, February 22, 2010 10:58:32 AM UTC-7, mailto:hoi...@gmail.com wrote:
> >
> > I think it's very common for schemas to include boolean elements as
> > "true" or "false" : http://www.w3.org/TR/xmlschema-2/#boolean
> >
> >
> > On 2010/02/22 17:49:25, rsc wrote:
> > > This assumes that boolean unmarshalling is broken.
> > > It's behaving exactly as the doc comment says:
> >
> > > // Unmarshal maps an XML element to a bool by setting the bool to
> > true.
> >
> > > I did this so that you can use a bool to tell whether
> > > an element is there at all. Whether that's correct
> > > behavior might be debated, but that makes this not
> > > a bug fix but a package change.
> >
> > > Russ
> >
> >
> > http://codereview.appspot.com/218050/show
> >
> >
Issue 218050: code review 218050: XML: Change behavior of boolean unmarshaling
(Closed)
Created 14 years, 2 months ago by hoisie
Modified 10 years, 7 months ago
Reviewers: darkhelmet_darkhelmetlive.com, Dominik Honnef
Base URL:
Comments: 2