Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/xml: unmarshal fails for numeric types if field empty #5857

Closed
eaigner opened this Issue Jul 10, 2013 · 11 comments

Comments

Projects
None yet
7 participants
@eaigner
Copy link
Contributor

eaigner commented Jul 10, 2013

When a XML tag contains an empty string, unmarshalling fails with

    strconv.ParseInt: parsing "": invalid syntax

A more sensible default would be to just omit this field if the value cannot be parsed
(is the zero value).
@robpike

This comment has been minimized.

Copy link
Contributor

robpike commented Jul 26, 2013

Comment 1:

Not clear what the behavior should be in this case, but it's worth being clear either
way.

Labels changed: added priority-later, removed priority-triage.

Status changed to Accepted.

@rsc

This comment has been minimized.

Copy link
Contributor

rsc commented Jul 30, 2013

Comment 2:

Labels changed: added go1.2maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

rsc commented Jul 30, 2013

Comment 3:

Labels changed: added feature.

@eaigner

This comment has been minimized.

Copy link
Contributor Author

eaigner commented Aug 19, 2013

Comment 4:

The origin for this issue would be XML like this:
    <a>
      <b nil="true">
    </a>
and
    <a>
      <b type="integer">1
    </a>
@robpike

This comment has been minimized.

Copy link
Contributor

robpike commented Aug 30, 2013

Comment 5:

Not for 1.2.

Labels changed: removed go1.2maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

rsc commented Nov 27, 2013

Comment 6:

Labels changed: added go1.3maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

rsc commented Nov 27, 2013

Comment 7:

Labels changed: removed feature.

@rsc

This comment has been minimized.

Copy link
Contributor

rsc commented Dec 4, 2013

Comment 8:

Labels changed: added release-none, removed go1.3maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

rsc commented Dec 4, 2013

Comment 9:

Labels changed: added repo-main.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@ivashyst

This comment has been minimized.

Copy link
Contributor

ivashyst commented Dec 30, 2017

This has been fixed by CL 38386.

@bradfitz

This comment has been minimized.

Copy link
Member

bradfitz commented Dec 31, 2017

@ivashyst, thanks.

@bradfitz bradfitz closed this Dec 31, 2017

@golang golang locked and limited conversation to collaborators Dec 31, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.