Xml encoder

Refactored to cache methods (obtained via reflection) instead of doing the look up each time.