Refactor encoding and marshaling.

Split the XML encoder out and interfaceize it.
Separate the concepts and responsibilities of marshaling and encoding.

Use Value.Kind() instead of Type.Kind().
Marshaling methods are now instance methods on Encoder.