src/main/java/de/alpharogroup/xml/ObjectToXmlExtensions.java
public static <T> String toXmlWithXMLEncoder(final T obj)
	{
		XMLEncoder enc = null;
		final ByteArrayOutputStream baos = new ByteArrayOutputStream();
		enc = new XMLEncoder(baos);
		enc.writeObject(obj);
		enc.close();
		return baos.toString();
	}
public static <T> String toXmlWithXMLEncoder(final T obj)
	{
		XMLEncoder enc = null;
		final ByteArrayOutputStream baos = new ByteArrayOutputStream();
		enc = new XMLEncoder(baos);
		enc.writeObject(obj);
		enc.close();
		return baos.toString();
	}
Creates from the given Object an xml string.

@param <T>
the generic type of the return type
@param obj
the obj to transform to an xml string.
@return the xml string