diff --git a/makefile b/makefile index f1578b2..2203c26 100644 --- a/makefile +++ b/makefile @@ -7,6 +7,5 @@ test: clean: make -C xmlx clean - -format: gofmt -w . + diff --git a/xmlx/document.go b/xmlx/document.go index 24f4b6a..1233e83 100644 --- a/xmlx/document.go +++ b/xmlx/document.go @@ -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 - } - buf.Write(s) + var b []byte + if b, err = ioutil.ReadAll(r); err != nil { + return } - - return this.LoadString(buf.String()) + return this.LoadString(string(b)) } // *****************************************************************************