[Serializer] Added XML attributes support for DomDocument in XmlEncoder.

This is a combination of 2 commits.

- [Serializer] Added encoding support for DomDocument in XmlEncoder

- [Serializer] Refactor code to allow setting <?xml standalone ?>

This commit refactors the createDomDocument(..) method in XmlEncoder
so
it can set the 'version', 'encoding' and 'standalone' attributes on
the
DOM document.

Code coverage of new code: 100%. Tests: pass.