Type type = mapping.getType(instance.getClass());
assertNotNull("no type found for " + instance.getClass().getName());
// create the document
Element element = createElement("urn:Bean", "root", "b");
MapNamespaceContext namespaces = new MapNamespaceContext();
for (Map.Entry<String, String> entry : getNamespaces().entrySet()) {
namespaces.addNamespace(entry.getKey(), entry.getValue());
}
ElementWriter rootWriter = getElementWriter(element, namespaces);
Context context = getContext();
// get Type based on the object instance