@Test
public void testXHTMLWithMisleading() throws Exception {

    //first test an acceptable XHTML header with http-equiv tags
    String test = "<?xml version=\"1.0\" ?>" +
            "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" +
            "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" +
            "<head>\n" +
            "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n" +
            "<title>title</title></head><body>body</body></html>";
    Metadata metadata = new Metadata();
    AUTO_DETECT_PARSER.parse(
            new ByteArrayInputStream(test.getBytes(UTF_8)),
            new BodyContentHandler(), metadata, new ParseContext());
    assertEquals("text/html; charset=iso-8859-1", metadata.get(TikaCoreProperties.CONTENT_TYPE_HINT));
    assertEquals("application/xhtml+xml; charset=ISO-8859-1", metadata.get(Metadata.CONTENT_TYPE));
    test = "<?xml version=\"1.0\" ?>" +
            "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" +
            "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" +
            "<head>\n" +
            "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-NUMBER_SEVEN\" />\n" +
            "<title>title</title></head><body>body</body></html>";
    metadata = new Metadata();
    AUTO_DETECT_PARSER.parse(
            new ByteArrayInputStream(test.getBytes(UTF_8)),
            new BodyContentHandler(), metadata, new ParseContext());
    assertEquals("text/html; charset=iso-NUMBER_SEVEN", metadata.get(TikaCoreProperties.CONTENT_TYPE_HINT));
    assertEquals("application/xhtml+xml; charset=ISO-8859-1", metadata.get(Metadata.CONTENT_TYPE));
}