StrutsHtmlMessageExtractor extends AbstractExtractorHandler implements MessageExtractor { @Override public void extractMessages(File file) throws IOException, MessageExtractorException { String systemId = file.getAbsolutePath(); log.debug("Extracting messages from {}", systemId); InputStream in = new FileInputStream(file); try { InputSource input = new InputSource(in); input.setSystemId(systemId); extractMessages(input); } finally { in.close(); } } StrutsHtmlMessageExtractor(MessageBundle bundle, boolean isXML); @Override void startDocument(); @Override void endDocument(); @Override void extractMessages(File file);  }
@Test public void testExtractor() throws IOException, MessageExtractorException { MessageBundle mb = new MessageBundle(); StrutsHtmlMessageExtractor ex = new StrutsHtmlMessageExtractor(mb, false); ex.extractMessages(new File("src/test/resources/index.jsp")); assertFalse(mb.isEmpty()); assertEquals(4, mb.size()); Message title = mb.getMessage("message.title"); assertNotNull(title); assertEquals("message.title", title.getMsgid()); Message imageSrc = mb.getMessage("image.test.src"); assertNotNull(imageSrc); assertEquals("image.test.src", imageSrc.getMsgid()); Message imageAlt = mb.getMessage("image.test.alt"); assertNotNull(imageAlt); assertEquals("image.test.alt", imageAlt.getMsgid()); Message imageTitle = mb.getMessage("image.test.title"); assertNotNull(imageTitle); assertEquals("image.test.title", imageTitle.getMsgid()); Properties props = mb.toOpenProps(); props.list(System.out); }