// When detecting generic XML (or possibly XHTML),
// extract the root element and match it against known types
if ("application/xml".equals(matched.getName())
|| "text/html".equals(matched.getName())) {
XmlRootExtractor extractor = new XmlRootExtractor();
QName rootElement = extractor.extractRootElement(data);
if (rootElement != null) {
for (MimeType type : xmls) {
if (type.matchesXML(
rootElement.getNamespaceURI(),
rootElement.getLocalPart())) {