@Test public void testParser() throws Exception { Table table = TableTagParser.getInstance().parser("org/mifos/framework/util/resources/customTableTag/example.xml"); Assert.assertNotNull(table); HeaderDetails details = table.getHeaderDetails(); Assert.assertEquals("drawtablerowbold", details.getHeaderStyle()); StringBuilder builder = new StringBuilder(); details.getHeaderInfo(builder); assertContains("drawtablerowbold", builder.toString()); Row row = table.getRow(); Assert.assertEquals("true", row.getBottomLineRequired()); Assert.assertEquals("100", row.getTotWidth()); Column[] columns = row.getColumn(); for (int i = 0; i < columns.length; i++) { if (i == 0) { Assert.assertEquals("text", columns[i].getColumnType()); Assert.assertEquals("Name", columns[i].getLabel()); Assert.assertEquals("Name", columns[i].getValue()); Assert.assertEquals("method", columns[i].getValueType()); StringBuilder builder2 = new StringBuilder(); Locale locale = new Locale("en", "GB"); OfficeDetailsDto officeDetailsDto = new OfficeDetailsDto(Short.valueOf("1"), "abcd", Short.valueOf("1"), "branch", Integer.valueOf("1")); ColumnDetails columnDetails = new ColumnDetails(); columnDetails.setRowStyle("drawtablerowbold"); columnDetails.setAlign("Down"); columns[i].setColumnDetials(columnDetails); columns[i].generateTableColumn(builder2, officeDetailsDto, locale, locale, 0); Assert.assertEquals("<td class=\"drawtablerowbold\" align=\"Down\" > </td>", builder2.toString()); } } }
public Table parser(String file) throws TableTagParseException { Table table = null; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); SchemaFactory schfactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); schfactory.setErrorHandler(null); Schema schema = schfactory.newSchema(new StreamSource(MifosResourceUtil.getClassPathResourceAsURIString(FilePaths.CUSTOMTABLETAGXSD))); factory.setNamespaceAware(false); factory.setValidating(false); factory.setSchema(schema); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setErrorHandler(null); Document document = builder.parse(MifosResourceUtil.getClassPathResourceAsURIString(file)); table = createTable(document); } catch (Exception e) { throw new TableTagParseException(e); } return table; }
TableTagParser { public Table parser(String file) throws TableTagParseException { Table table = null; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); SchemaFactory schfactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); schfactory.setErrorHandler(null); Schema schema = schfactory.newSchema(new StreamSource(MifosResourceUtil.getClassPathResourceAsURIString(FilePaths.CUSTOMTABLETAGXSD))); factory.setNamespaceAware(false); factory.setValidating(false); factory.setSchema(schema); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setErrorHandler(null); Document document = builder.parse(MifosResourceUtil.getClassPathResourceAsURIString(file)); table = createTable(document); } catch (Exception e) { throw new TableTagParseException(e); } return table; } }
TableTagParser { public Table parser(String file) throws TableTagParseException { Table table = null; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); SchemaFactory schfactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); schfactory.setErrorHandler(null); Schema schema = schfactory.newSchema(new StreamSource(MifosResourceUtil.getClassPathResourceAsURIString(FilePaths.CUSTOMTABLETAGXSD))); factory.setNamespaceAware(false); factory.setValidating(false); factory.setSchema(schema); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setErrorHandler(null); Document document = builder.parse(MifosResourceUtil.getClassPathResourceAsURIString(file)); table = createTable(document); } catch (Exception e) { throw new TableTagParseException(e); } return table; }  }
TableTagParser { public Table parser(String file) throws TableTagParseException { Table table = null; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); SchemaFactory schfactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); schfactory.setErrorHandler(null); Schema schema = schfactory.newSchema(new StreamSource(MifosResourceUtil.getClassPathResourceAsURIString(FilePaths.CUSTOMTABLETAGXSD))); factory.setNamespaceAware(false); factory.setValidating(false); factory.setSchema(schema); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setErrorHandler(null); Document document = builder.parse(MifosResourceUtil.getClassPathResourceAsURIString(file)); table = createTable(document); } catch (Exception e) { throw new TableTagParseException(e); } return table; }  static TableTagParser getInstance(); Table parser(String file); }
TableTagParser { public Table parser(String file) throws TableTagParseException { Table table = null; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); SchemaFactory schfactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); schfactory.setErrorHandler(null); Schema schema = schfactory.newSchema(new StreamSource(MifosResourceUtil.getClassPathResourceAsURIString(FilePaths.CUSTOMTABLETAGXSD))); factory.setNamespaceAware(false); factory.setValidating(false); factory.setSchema(schema); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setErrorHandler(null); Document document = builder.parse(MifosResourceUtil.getClassPathResourceAsURIString(file)); table = createTable(document); } catch (Exception e) { throw new TableTagParseException(e); } return table; }  static TableTagParser getInstance(); Table parser(String file);  }