gofix for weekly.2012-01-27

This commit is contained in:
jim teeuwen 2012-01-27 11:51:02 +01:00
parent b5c33469fa
commit 6e76dc96aa
2 changed files with 3 additions and 3 deletions

View File

@ -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)

View File

@ -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