Skip to content

encoding/xml: document that NewDecoder buffers unless given an io.ByteReader #7225

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

Closed
gopherbot opened this issue Jan 28, 2014 · 4 comments
Closed
Milestone

Comments

@gopherbot
Copy link
Contributor

by clbanning:

Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:

Run "go version" and compare against
http://golang.org/doc/devel/release.html  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.

Thanks.

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
http://play.golang.org/p/RQGcVFftK0

What is the expected output?
http://play.golang.org/p/49o-4SNGkb

s: main.docStruct{Tag:"Hello World"}
raw: <doc><tag>Hello World</tag></doc>
s: main.docStruct{Tag:"Hello Again"}
raw: <doc><tag>Hello Again</tag></doc>

What do you see instead?

s: main.docStruct{Tag:"Hello World"}
raw: <doc><tag>Hello
World</tag></doc><doc><tag>Hello Again</tag></doc>

Which compiler are you using (5g, 6g, 8g, gccgo)?
Go Playground

Which operating system are you using?
OS X 10.9.1

Which version are you using?  (run 'go version')
go version go1.2 darwin/amd64

Please provide any additional information below.

The comment on d.switchToReader (encoding/xml/xml.go line 314) says that it wants to use
an io.ByteReader for speed - OK.
 However, then please document that if you want xml.Decoder to use the actual io.Reader passed to xml.NewDecoder,  then it must satisfy the io.ByteReader interface, as well.
@gopherbot
Copy link
Contributor Author

Comment 1 by clbanning:

This is a little more efficient version of the work around:
http://play.golang.org/p/8ssC5U0kiw.

@rsc
Copy link
Contributor

rsc commented Mar 3, 2014

Comment 2:

Labels changed: added release-go1.3.

Status changed to Accepted.

@bradfitz
Copy link
Contributor

Comment 3:

This issue was closed by revision 877e0a1.

Status changed to Fixed.

@gopherbot
Copy link
Contributor Author

Comment 4:

CL https://golang.org/cl/88710043 mentions this issue.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants