func (s Serializer) Deserialize(r io.Reader) (root *rbxfile.Root, err error) {
	if s.Decoder == nil {
		return nil, errors.New("a decoder has not been not specified")
	}
	document := new(Document)
	if _, err = document.ReadFrom(r); err != nil {
		return nil, errors.New("error parsing document: " + err.Error())
	}
	root, err = s.Decoder.Decode(document)
	if err != nil {
		return nil, errors.New("error decoding data: " + err.Error())
	}
	return root, nil
}
Deserialize decodes data from r into a Root structure using the specified
decoder.
package xml
import (
	"errors"
	"github.com/robloxapi/rbxapi"
	"github.com/robloxapi/rbxfile"
	"io"
)
type Decoder interface {
	Decode(document *Document) (root *rbxfile.Root, err error)
}
type Encoder interface {
	Encode(root *rbxfile.Root) (document *Document, err error)
}
type Serializer struct {
	Decoder Decoder
	Encoder Encoder
}
func NewSerializer(d Decoder, e Encoder) Serializer {
	s := Serializer{
		Decoder: d,
		Encoder: e,
	}
	if d == nil || e == nil {
		var codec RobloxCodec
		if d == nil {
			s.Decoder = codec
		}
		if e == nil {
			s.Encoder = codec
		}
	}
	return s
}