Fixed bug in Document.LoadStream() function.
This commit is contained in:
parent
15ec07ab1a
commit
d0d1c2f9f5
|
@ -30,7 +30,6 @@ package xmlx
|
|||
|
||||
import "os"
|
||||
import "io"
|
||||
import "bytes"
|
||||
import "io/ioutil"
|
||||
import "path"
|
||||
import "strings"
|
||||
|
@ -182,17 +181,11 @@ func (this *Document) LoadUri(uri string) (err os.Error) {
|
|||
}
|
||||
|
||||
func (this *Document) LoadStream(r io.Reader) (err os.Error) {
|
||||
var buf bytes.Buffer
|
||||
s := make([]byte, 1024)
|
||||
|
||||
for {
|
||||
if _, err = r.Read(s); err != nil {
|
||||
break
|
||||
var b []byte
|
||||
if b, err = ioutil.ReadAll(r); err != nil {
|
||||
return
|
||||
}
|
||||
buf.Write(s)
|
||||
}
|
||||
|
||||
return this.LoadString(buf.String())
|
||||
return this.LoadString(string(b))
|
||||
}
|
||||
|
||||
// *****************************************************************************
|
||||
|
|
Loading…
Reference in New Issue