Add toXml() method to BaseType class.

PHP classes can now generate a XML string representation of themselves.