if (base instanceof Document) {
Document doc = (Document)base;
MimeType mt = doc.getContentType();
type = (mt != null) ? mt.toString() : getMimeType(doc.getRoot());
} else if (base instanceof Element) {
Element el = (Element)base;
if (el.getDocument() != null) {
MimeType mt = el.getDocument().getContentType();
type = (mt != null) ? mt.toString() : null;
}
if (type == null) {
if (el instanceof Feed || el instanceof Entry)
type = Constants.ATOM_MEDIA_TYPE;