HtmlSchemaParser implements SchemaParser { @Override public Schema parse(Request request) { try { SimpleHeadersContentHandler headersContentHandler = new SimpleHeadersContentHandler(); InputStream inputStream = request.getContent(); HtmlParser htmlParser = new HtmlParser(); Metadata metadata = new Metadata(); htmlParser.parse(inputStream, headersContentHandler, metadata, new ParseContext()); List<ColumnMetadata> columns = new ArrayList<>(headersContentHandler.getHeaderValues().size()); for (String headerValue : headersContentHandler.getHeaderValues()) { columns.add(ColumnMetadata.Builder .column() .type(Type.STRING) .name(headerValue) .id(columns.size()) .build()); } Schema.SheetContent sheetContent = new Schema.SheetContent(); sheetContent.setColumnMetadatas(columns); return Schema.Builder .parserResult() .sheetContents(Collections.singletonList(sheetContent)) .draft(false) .build(); } catch (Exception e) { LOGGER.debug("Exception during parsing html request :" + e.getMessage(), e); throw new TDPException(CommonErrorCodes.UNEXPECTED_EXCEPTION, e); } }  @Override Schema parse(Request request);  }
@Test public void read_html_TDP_1136() throws Exception { try (InputStream inputStream = this.getClass().getResourceAsStream("sales-force.xls")) { SchemaParser.Request request = getRequest(inputStream, "#1"); request.getMetadata().setEncoding("UTF-16"); Schema result = parser.parse(request); Assertions.assertThat(result).isNotNull(); Assertions.assertThat(result.getSheetContents()).isNotNull().isNotEmpty().hasSize(1); List<ColumnMetadata> columnMetadatas = result.getSheetContents().get(0).getColumnMetadatas(); Assertions.assertThat(columnMetadatas).isNotNull().isNotEmpty().hasSize(7); Assertions .assertThat(columnMetadatas.get(0)) .isEqualToComparingOnlyGivenFields( ColumnMetadata.Builder .column() .type(Type.STRING) .id(0) .name("UID") .build(), "id", "name", "type"); Assertions .assertThat(columnMetadatas.get(1)) .isEqualToComparingOnlyGivenFields( ColumnMetadata.Builder .column() .type(Type.STRING) .id(1) .name("Team Member: Name") .build(), "id", "name", "type"); Assertions .assertThat(columnMetadatas.get(2)) .isEqualToComparingOnlyGivenFields( ColumnMetadata.Builder .column() .type(Type.STRING) .id(2) .name("Country") .build(), "id", "name", "type"); } }