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: document that NewDecoder buffers unless given an io.ByteReader #7225

gopherbot opened this issue Jan 28, 2014 · 4 comments


Copy link

@gopherbot gopherbot commented Jan 28, 2014

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  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.


What steps will reproduce the problem?
If possible, include a link to a program on

What is the expected output?

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.

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jan 28, 2014

Comment 1 by clbanning:

This is a little more efficient version of the work around:

This comment has been minimized.

Copy link

@rsc rsc commented Mar 3, 2014

Comment 2:

Labels changed: added release-go1.3.

Status changed to Accepted.


This comment has been minimized.

Copy link

@bradfitz bradfitz commented Apr 17, 2014

Comment 3:

This issue was closed by revision 877e0a1.

Status changed to Fixed.


This comment has been minimized.

Copy link

@gopherbot gopherbot commented Apr 17, 2014

Comment 4:

CL 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.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.