diff --git a/document.go b/document.go index 3811cee..6ef83be 100644 --- a/document.go +++ b/document.go @@ -26,10 +26,10 @@ package xmlx import ( "bytes" + "code.google.com/p/go-charset/charset" "encoding/xml" "errors" "fmt" - "go-charset.googlecode.com/hg/charset" "io" "io/ioutil" "net/http" @@ -80,7 +80,7 @@ func (this *Document) SelectNodes(namespace, name string) []*Node { // Load the contents of this document from the supplied reader. func (this *Document) LoadStream(r io.Reader) (err error) { - xp := xml.NewParser(r) + xp := xml.NewDecoder(r) xp.Entity = this.Entity xp.CharsetReader = func(enc string, input io.Reader) (io.Reader, error) { return charset.NewReader(enc, input) diff --git a/node.go b/node.go index 40faeaf..a1de0ba 100644 --- a/node.go +++ b/node.go @@ -45,7 +45,7 @@ func NewNode(tid byte) *Node { // This wraps the standard xml.Unmarshal function and supplies this particular // node as the content to be unmarshalled. func (this *Node) Unmarshal(obj interface{}) error { - return xml.Unmarshal(bytes.NewBuffer(this.Bytes()), obj) + return xml.NewDecoder(bytes.NewBuffer(this.Bytes())).Decode(obj) } // Get node value as string